Change Location in the google search page

2011-09-15 Thread sajuptpm
Hi, I want to open Google search page and Change the Location link in the left hand nav of Google) from the users current location to a different location, then return the results of the updated search. I tried to change google search location through http://www.google.co.in/preferences?hl=en#loc

Re: stackoverflow and c.l.py

2011-09-15 Thread Westley Martínez
On Thu, Sep 15, 2011 at 09:58:32AM +1000, Steven D'Aprano wrote: > memilanuk wrote: > > > On 09/14/2011 05:47 AM, Chris Angelico wrote: > >> The SNR here isn't bad either. Most of the spam gets filtered out, and > >> even stuff like Ranting Rick posts can be of some amusement when it's > >> a slow

Re: stackoverflow and c.l.py

2011-09-15 Thread john
On Sep 14, 4:58 pm, Steven D'Aprano wrote: > memilanuk wrote: > > On 09/14/2011 05:47 AM, Chris Angelico wrote: > >> The SNR here isn't bad either. Most of the spam gets filtered out, and > >> even stuff like Ranting Rick posts can be of some amusement when it's > >> a slow day... > > > I subscrib

method:wrong structure

2011-09-15 Thread 守株待兔
there are three programs,all of them left main structure, code0 is ok,i don't know why code2 and code3 can't run,how to fix them? code0 class webdata(object): def __init__(self,arg): def loadequity(self): def loadoption(self): #loadstatus={'equ

Re: method:wrong structure

2011-09-15 Thread Chris Rebert
2011/9/15 守株待兔 <1248283...@qq.com>: > there are  three  programs,all of them  left  main  structure, > code0 is ok,i don't know why code2 and code3 can't run,how to fix them? > code0 > class   webdata(object): >     def  __init__(self,arg): > >     def  loadequity(self): > >     def  loadoption(sel

Re: stackoverflow and c.l.py

2011-09-15 Thread Chris Angelico
On Thu, Sep 15, 2011 at 1:05 PM, Westley Martínez wrote: > This is really what I love and hate about the internet.  It's full of > people who argue for the sake of venting their internal frustrations. > How many discussions comparing declarative and imperative programming > languages have you seen

Re: help regarding re.search

2011-09-15 Thread Gelonida N
Hi Sagar, In order to be able to help you I propose following: On 09/15/2011 06:54 AM, Sagar Neve wrote: . . . > print "hello..Man_Param=%s,Opt_Param1=%s, > Opt_Param2=%s\n" %(Man_Param,Opt_Param1,Opt_Param2) Change above line into > print "hello..Man_Par

Re: method:wrong structure

2011-09-15 Thread Nizamov Shawkat
> >     loadstatus={'equity':self.loadequity(),'option':self,loadoption()} > comma instead of dot after self. -- http://mail.python.org/mailman/listinfo/python-list

Re: help regarding re.search

2011-09-15 Thread Sagar Neve
Hey Thanks. I just resolved it and yes you are right there was a (hidden) new-line to it. I found it in a crude way of putting dots before and after. I was to post about it here and saw your message. I was not knowing about %r. Thanks for that. Thats a good addition to my knowledge. Thanks a bu

How does a function know the docstring of its code object?

2011-09-15 Thread Arnaud Delobelle
Hi all, You can do: def foo(): "foodoc" pass function = type(lambda:0) foo2 = function(foo.__code__, globals()) assert foo2.__doc__ == "foodoc" I am wondering how the function constructor knows that foo.__code__ has a docstring. I can see that foo.__code__.co_consts == ('foodoc',)

Re: cause __init__ to return a different class?

2011-09-15 Thread Jonathan Hartley
Perhaps a more idiomatic way of achieving the same thing is to use a factory function, which returns instances of different classes: def PersonFactory(foo): if foo: return Person() else: return Child() Apologies if the code is messed up, I'm posting from Google g

What is wrong with this code?

2011-09-15 Thread superhappyfuntime
it's not running. here it is: #this is antiWYSIWYG, an easy to learn cap for begginners to LaTeX. #this is defines what means what. you can just read howto.pdf instead of this part. here it is: = '\begin{document}' it's an article = '\documentclass article' it's a book = '\documentclass{book

Turkic I and re

2011-09-15 Thread MRAB
I'm interested to know the opinion of Turkish users of the re or regex module. When the re module performs a case-insensitive match, it matches 'I' with 'i'. In Turkish, however, it should match 'I' with 'ı' and 'İ' with 'i'. The regex module at http://pypi.python.org/pypi/regex currently uses a

Re: Turkic I and re

2011-09-15 Thread Alan Plum
On 2011-09-15 15:02, MRAB wrote: The regex module at http://pypi.python.org/pypi/regex currently uses a compromise, where it matches 'I' with 'i' and also 'I' with 'ı' and 'İ' with 'i'. I was wondering if it would be preferable to have a TURKIC flag instead ("(?T)" or "(?T:...)" in the pattern).

Re: using python in web applications

2011-09-15 Thread Alan Plum
On 2011-09-11 02:50, Littlefield, Tyler wrote: I replied to that one off list I guess, but I figured Django was way more overhead than I wanted, doesn't really fit with solving the speed issue. Depending on your needs, you may find something like bottle or Flask a better choice then. Django

Re: using python in web applications

2011-09-15 Thread Roy Smith
In article , Alan Plum wrote: > Django can be scaled down a lot, but it's a full-featured framework at > its heart. You can pick and chose which parts of django you want to use. You don't need to use any of the Django model stuff. You don't need to use any of the template system. You can

Re: Turkic I and re

2011-09-15 Thread John-John Tedro
On Thu, Sep 15, 2011 at 1:16 PM, Alan Plum wrote: > On 2011-09-15 15:02, MRAB wrote: > >> The regex module at >> http://pypi.python.org/pypi/**regexcurrently >> uses a >> compromise, where it matches 'I' with 'i' and also 'I' with 'ı' and 'İ' >> with 'i'. >> >

Re: Turkic I and re

2011-09-15 Thread MRAB
On 15/09/2011 14:44, John-John Tedro wrote: On Thu, Sep 15, 2011 at 1:16 PM, Alan Plum mailto:m...@alanplum.com>> wrote: On 2011-09-15 15:02, MRAB wrote: The regex module at http://pypi.python.org/pypi/__regex currently uses a comp

Re: What is wrong with this code?

2011-09-15 Thread Ulrich Eckhardt
superhappyfuntime wrote: > #this is antiWYSIWYG, an easy to learn cap for begginners to LaTeX. It's LaTeX, not Python. Uli -- http://mail.python.org/mailman/listinfo/python-list

Re: What is wrong with this code?

2011-09-15 Thread John Gordon
In superhappyfuntime writes: > it's not running. here it is: > #this is antiWYSIWYG, an easy to learn cap for begginners to LaTeX. > #this is defines what means what. you can just read howto.pdf instead > of this part. > here it is: = '\begin{document}' > it's an article = '\documentclass a

Re: cause __init__ to return a different class?

2011-09-15 Thread Matthew Pounsett
On Sep 15, 1:35 am, Chris Rebert wrote: > Override __new__() instead: > http://docs.python.org/reference/datamodel.html#object.__new__ Aha.. thanks! The reference book I'm working from neglects to mention __new__, so I'd assumed __init__ was the constructor. It hadn't occurred to me that python

Re: cause __init__ to return a different class?

2011-09-15 Thread Matthew Pounsett
On Sep 15, 1:54 am, Ryan Kelly wrote: > The above will do exactly what you want, but it's generally bad style > unless you have a very specific use-case.  Is there a particular reason > you need to "magically" return a subclass, rather than making this > explicit in the code? > > To be friendlier

Re: Turkic I and re

2011-09-15 Thread Tim Chase
On 09/15/11 09:06, MRAB wrote: It's somewhat unlikely that Unicode will become locale-dependent in Python because it would cause problems; you don't want: "i".upper() == "I" to be maybe true, maybe false. An option would be to specify whether it should be locale-dependent. There have b

Re: Turkic I and re

2011-09-15 Thread Yaşar Arabacı
Hi, I am a Turkish self-taught python user. Personally, I don't think I am in a position to discuss a issue in this scale. But in my opinion, I think pardus* developers should be invited to join to this discussion. As they are using python heavily on most of their projects** I think they would hav

Re: How does a function know the docstring of its code object?

2011-09-15 Thread Ian Kelly
On Thu, Sep 15, 2011 at 5:10 AM, Arnaud Delobelle wrote: > Hi all, > > You can do: > > def foo(): >    "foodoc" >    pass > > function = type(lambda:0) > foo2 = function(foo.__code__, globals()) > assert foo2.__doc__ == "foodoc" > > I am wondering how the function constructor knows that foo.__code

Re: How does a function know the docstring of its code object?

2011-09-15 Thread Arnaud Delobelle
On 15 September 2011 16:17, Ian Kelly wrote: > On Thu, Sep 15, 2011 at 5:10 AM, Arnaud Delobelle wrote: >> Hi all, >> >> You can do: >> >> def foo(): >>    "foodoc" >>    pass >> >> function = type(lambda:0) >> foo2 = function(foo.__code__, globals()) >> assert foo2.__doc__ == "foodoc" >> >> I am

From Python on Solaris to Python on LINUX

2011-09-15 Thread Geneviève Diagorn
Hi, I work on projects developed in Python 2.3 on Solaris. The customer asks us to pass on LINUX in a recent version of Python. Is it someone has already realized this modification? What are the traps to be avoided? Is it a long and difficult phase? What is the most recent version on LINUX?

Request for research feedback

2011-09-15 Thread Fulvio Valente
Hi, I am a research intern at the University of Strathclyde who has been doing a summer research internship. I hope that this is not an inappropriate place to ask, but I am looking for participants willing to use and evaluate an application that was written as part of this internship. If you cho

[ANN} OpenOpt, FuncDesigner, DerApproximator, SpaceFuncs release 0.36 Options

2011-09-15 Thread dmitrey
Hi all, new release of our free scientific soft (OpenOpt, FuncDesigner, DerApproximator, SpaceFuncs) v. 0.36 is out: OpenOpt: Now solver interalg can handle all types of constraints and integration problems Some minor improvements and code cleanup FuncDesigner: Interval analysis now

Re: cause __init__ to return a different class?

2011-09-15 Thread Miki Tebeka
I'd go for a factory function (http://en.wikipedia.org/wiki/Factory_method_pattern): def create(foo): return Child(foo) if foo else Parent() -- http://mail.python.org/mailman/listinfo/python-list

help regarding extracting a smaller list from larger one

2011-09-15 Thread neeru K
Dear Python Users, I am trying to write a code for visualization (raster plots and peri-event time histogram) of time series electrophysiological data using numpy, scipy and matlplotlib in python. I am importing the data into list using loadtext command. I was curious if anyone is aware of a functi

Re: From Python on Solaris to Python on LINUX

2011-09-15 Thread Philipp Hagemeister
> What are the traps to be avoided? Assuming you're not using any OS features (scan the code for "/dev" and "/proc"), the transition from Solaris to Linux will be seamless. Your main problem will be the transition from the archaic Python 2.3 to a modern one. Luckily, all 2.x Pythons should be bac

how to make a nested list

2011-09-15 Thread Stef Mientki
hello, I need a nested list, like this >>> A= [ [None,None], [None,None], [None, None] ] >>> A[2][0] =77 >>> A [[None, None], [None, None], [77, None]] Because the list is much larger, I need a shortcut (ok I can use a for loop) So I tried >>> B = 3 * [ [ None, None ]] >>> B[2][0] = 77 >>> B [

RE: how to make a nested list

2011-09-15 Thread Prasad, Ramit
>>> B = 3 * [ [ None, None ]] That makes a list of the exact same list object: [ a, a, a ] where a = [ None, None ]. Instead I would do something like (untested python2.x): B = [ [ None, None ] for x in xrange(3) ] Ramit Ramit Prasad | JPMorgan Chase Investment Bank | Currencies Technology 712

Re: how to make a nested list

2011-09-15 Thread Peter Pearson
On Thu, 15 Sep 2011 18:57:24 +0200, Stef Mientki wrote: [snip] > Because the list is much larger, I need a shortcut (ok I can use a for loop) > So I tried > >>> B = 3 * [ [ None, None ]] > >>> B[2][0] = 77 > >>> B > [[77, None], [77, None], [77, None]] > > which doesn't work as expected. > > any su

Re: how to make a nested list

2011-09-15 Thread Gary Herron
On 09/15/2011 09:57 AM, Stef Mientki wrote: hello, I need a nested list, like this >>> A= [ [None,None], [None,None], [None, None] ] >>> A[2][0] =77 >>> A [[None, None], [None, None], [77, None]] Because the list is much larger, I need a shortcut (ok I can use a for loop) So I tried >>> B =

Re: From Python on Solaris to Python on LINUX

2011-09-15 Thread GrayShark
I think that was more of a version question the Kernel questin 1) you can install any and all versions python on a linux computer. You just need you app to select the correct path, correct python interpret. Likely there many be some some drivers in /dev that are not the same as in Solaris. But th

Re: help regarding extracting a smaller list from larger one

2011-09-15 Thread Gary Herron
On 09/15/2011 09:40 AM, neeru K wrote: Dear Python Users, I am trying to write a code for visualization (raster plots and peri-event time histogram) of time series electrophysiological data using numpy, scipy and matlplotlib in python. I am importing the data into list using loadtext command.

Re: Reconciling os.path.getmtime vs ftp.sendcmd('MDTM filename')

2011-09-15 Thread Tim Johnson
* Tim Johnson [110914 18:18]: > * Chris Rebert [110914 16:46]: > > On Wed, Sep 14, 2011 at 12:50 PM, Tim Johnson wrote: > > > I have written a class that uses ftplib.FTP as the parent. > > > I need to reconcile the modified time of a workstation file with > > > that same filename on a remote ser

Re: cause __init__ to return a different class?

2011-09-15 Thread Arnaud Delobelle
On 15 September 2011 15:41, Matthew Pounsett wrote: > On Sep 15, 1:35 am, Chris Rebert wrote: >> Override __new__() instead: >> http://docs.python.org/reference/datamodel.html#object.__new__ > > Aha.. thanks!  The reference book I'm working from neglects to mention > __new__, so I'd assumed __ini

Re: how to make a nested list

2011-09-15 Thread John Ladasky
Stef, Are your bottom-level lists always of length 2? If so, then you could use an array, instead of a list of lists. Python ships with a module called array, but it doesn't allow you to put non-numeric types into arrays, and it looks like you want the NoneType. I use the popular numpy module,

Re: help regarding extracting a smaller list from larger one

2011-09-15 Thread neeru K
Dear Gary, thank you for the reply. I will be more specific and take the same example that you have given and tell you what is my problem - array([0.0, 1.3, 2.45, 3.87, 4.54, 5.11, 6.90, 7.78, 8.23, 9.01]) from this array I want to a sub-list with lower and upper indexes that are not present in the

Re: Cancel or timeout a long running regular expression

2011-09-15 Thread Terry Reedy
On 9/15/2011 1:19 AM, pyt...@bdurham.com wrote: Is there a way to cancel or timeout a long running regular expression? I have a program that accepts regular expressions from users and I'm concerned about how to handle worst case regular expressions that seem to run forever. Ideally I'm looking fo

Re: Request for research feedback

2011-09-15 Thread Waldek M.
On Thu, 15 Sep 2011 16:55:13 +0100, Fulvio Valente wrote: > Hi, I am a research intern at the University of Strathclyde > who has been doing a summer research internship. I don't want to be rude, but please: could you rather first research how to use a newsreader before you use it? These long lin

Re: PC locks up with list operations

2011-09-15 Thread John Nagle
On 8/31/2011 5:40 AM, Chris Withers wrote: On 31/08/2011 13:33, Steven D'Aprano wrote: I am using Linux desktops; both incidents were with Python 2.5. Do newer versions of Python respond to this sort of situation more gracefully? Ironically, Windows does better here and dumps you out with a Me

RE: Request for research feedback

2011-09-15 Thread Prasad, Ramit
I don't want to be rude but... Rude: >I don't want to be rude, but please: could you rather first research >how to use a newsreader before you use it? >These long lines (a few times the limit of 78 characters per line) >make your post unreadable. Not rude: >These long lines (a few times the limit

Re: Request for research feedback

2011-09-15 Thread Fulvio Valente
Whoops, I thought the rather iffy Exchange web client at my institution would've wrapped outgoing messages automatically. I'm now using a proper client for that account which should prevent such issues in the future. Thanks for the heads up. For anyone who couldn't stand to read the original m

multiprocessing.Pool, its queue, and pre-emption

2011-09-15 Thread John Ladasky
Suppose that I have a multi-core computer with N CPU's, and I create a multiprocessing.Pool in Python 2.6 with N-1 Processes. (My rationale for choosing N-1 Processes was discussed here: http://groups.google.com/group/comp.lang.python/browse_frm/thread/65ba3ccd4be8228c) Then I use Pool.map_async(

Re: Accessing matplotlib-users discussion group?

2011-09-15 Thread John Ladasky
Hate to bump this, but... I found Sourceforge's IRC, and tried to ask for help there, and it doesn't look like I can get any help until business hours tomorrow. Anyone? -- http://mail.python.org/mailman/listinfo/python-list

Re: how to make a nested list

2011-09-15 Thread Vlastimil Brom
2011/9/15 Stef Mientki : > hello, > > I need a nested list, like this > A= [ [None,None], [None,None], [None, None] ] A[2][0] =77 A > [[None, None], [None, None], [77, None]] > ... > > thanks, > Stef > -- > http://mail.python.org/mailman/listinfo/python-list > Besides the above suge

Re: multiprocessing.Pool, its queue, and pre-emption

2011-09-15 Thread Chris Angelico
On Fri, Sep 16, 2011 at 6:52 AM, John Ladasky wrote: > Suppose that I have a second, parallelizable, long-running task T2 > that I want to address in REAL TIME when the need arises.  Using Pool, > is there a way for me to insert the chunks of T2 at the HEAD of the > task queue, instead of at its T

Re: how to make a nested list

2011-09-15 Thread Chris Angelico
On Fri, Sep 16, 2011 at 8:02 AM, Vlastimil Brom wrote: > Besides the above sugestions to correct the nested list approach, > if you need to set and access the data at the given "coordinates" you > could also use a nested defaultdict... The defaultdict is efficient for a sparse matrix, but I suspe

Re: help regarding extracting a smaller list from larger one

2011-09-15 Thread Gary Herron
On 09/15/2011 11:55 AM, neeru K wrote: Dear Gary, thank you for the reply. I will be more specific and take the same example that you have given and tell you what is my problem - array([0.0, 1.3, 2.45, 3.87, 4.54, 5.11, 6.90, 7.78, 8.23, 9.01]) from this array I want to a sub-list with lower an

Re: multiprocessing.Pool, its queue, and pre-emption

2011-09-15 Thread John Ladasky
On Sep 15, 3:14 pm, Chris Angelico wrote: > On Fri, Sep 16, 2011 at 6:52 AM, John Ladasky wrote: > > Suppose that I have a second, parallelizable, long-running task T2 > > that I want to address in REAL TIME when the need arises.  Using Pool, > > is there a way for me to insert the chunks of T2 a

Re: Cancel or timeout a long running regular expression

2011-09-15 Thread Chris Angelico
On Fri, Sep 16, 2011 at 4:54 AM, Terry Reedy wrote: > On 9/15/2011 1:19 AM, pyt...@bdurham.com wrote: >> I was thinking there might be a technique I could use to evaluate >> regular expressions in a thread or another process launched via >> multiprocessing module and then kill the thread/process a

Re: multiprocessing.Pool, its queue, and pre-emption

2011-09-15 Thread Chris Angelico
On Fri, Sep 16, 2011 at 8:25 AM, John Ladasky wrote: > Starting 50 milliseconds late would be close enough > to "real time" for my purposes. > ... > > If that's not putting T2 at the head of the queue, I guess I don't > know a better way to describe it. Yep, your terms are correct, with that cave

Re: multiprocessing.Pool, its queue, and pre-emption

2011-09-15 Thread John Ladasky
Ah. Now, see? Having the right vocabulary helps. Searching for "priority queue" brings up this discussion from back in January: http://groups.google.com/group/comp.lang.python/browse_frm/thread/b69aeced28634898 Now, this discussion refers to a PriorityPool class which doesn't appear to be a sta

Re: multiprocessing.Pool, its queue, and pre-emption

2011-09-15 Thread Chris Angelico
On Fri, Sep 16, 2011 at 8:32 AM, John Ladasky wrote: > Ah. Now, see?  Having the right vocabulary helps.  Searching for > "priority queue" brings up this discussion from back in January: > > http://groups.google.com/group/comp.lang.python/browse_frm/thread/b69aeced28634898 > > Now, this discussion

Re: From Python on Solaris to Python on LINUX

2011-09-15 Thread Cameron Simpson
On 15Sep2011 17:30, Genevi�ve Diagorn wrote: | I work on projects developed in Python 2.3 on Solaris. The customer asks us | to pass on LINUX in a recent version of Python. | | Is it someone has already realized this modification? What are the traps to | be avoided? | | Is it a long and difficul

RE: help regarding extracting a smaller list from larger one

2011-09-15 Thread Prasad, Ramit
>Nevertheless, I think list comprehension is what you want: > [ x for x in A if 3.0 <= x <= 8.0 ] >will extract all the values between 3 and 8 from the array A and create >a new list containing them. >If you want the new list to be a numpy array then > numpy.array([ x for x in A if 3.

Comparisons of computation timing

2011-09-15 Thread Akand Islam
I have run my codes (written in Python) in my Notebook (3 GB Ram, Dual- core CPU T4500 @ 2.3 GHz) and in my lab machine (11.57 GB Ram, i7-920 CPU @ 2.67 GHz). However, I have found execution time in Notebook 250.3 seconds, and in Lab machine 333.2 seconds. How is it possible? Good configuration mac

Re: Request for research feedback

2011-09-15 Thread Waldek M.
On Thu, 15 Sep 2011 16:11:13 -0400, Prasad, Ramit wrote: > I don't want to be rude but... > Not rude: > Rude: You're right. I must have gotten a few bad habits I didn't even realize. Thanks. Waldek -- http://mail.python.org/mailman/listinfo/python-list

Re: multiprocessing.Pool, its queue, and pre-emption

2011-09-15 Thread John Ladasky
On Sep 15, 1:52 pm, John Ladasky wrote: > I've been snooping around inside Pool, and I would guess that what I > want to do is to manipulate Pool._inqueue, which is a > multiprocessing.queues.SimpleQueue object.  I haven't found any > documentation for SimpleQueue.  It appears to have only the mos