Re: error: cannot invoke setopt() - perform() is currently running

2009-01-14 Thread alex goretoy
sorry for multi posting It's a habit I have. The closest thing I can come up with is this http://pycurl.cvs.sourceforge.net/viewvc/pycurl/pycurl/examples/retriever-multi.py?revision=1.29&view=markup but how to make this work with pcrunchly and threading Thread? On 1/15/09, alex goretoy wrote:

Re: error: cannot invoke setopt() - perform() is currently running

2009-01-14 Thread alex goretoy
more info for all: the class I'm trying to use threading on top of called pcrunchly. I've posted it previously on here, but you can find it at this link. http://article.gmane.org/gmane.comp.python.general/604050 How can i make this work with threading Thread? On 1/15/09, alex goretoy wrote: >

Re: 2to3 Help?

2009-01-14 Thread John Machin
On Jan 15, 5:52 pm, marco.m.peter...@gmail.com wrote: > Oh okay. I don't think my Python installation is in PATH yet. I'll try > to add it then. Am I permitted to ask a really silly question? Thanks. Here it is: How much working 2.X code do you have that needs migrating from 2.x to 3.x? Cheers, J

error: cannot invoke setopt() - perform() is currently running

2009-01-14 Thread alex goretoy
hello all, I have a problem when using pycurl with threading Thread from threading import Thread the error i get is this: error: cannot invoke setopt() - perform() is currently running how do I catch a error like this in my code and perform a action like wait for perform to finish until it tr

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-14 Thread Russ P.
On Jan 14, 9:51 pm, Michele Simionato wrote: > On Jan 13, 2:48 am, "Russ P." wrote: > > > I started looking at Scala a while back. It is has many nice features. > > It seamlessly combines object orientation with advanced functional > > programming. > > I don't like that. Scala was designed with t

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-14 Thread alex23
On Jan 15, 1:06 pm, Paul Rubin wrote: > I just looked up Cython and see that it's based on Pyrex.  Worth > knowing about, I guess; but basically I think C is evil. I feel much the same way, but the recent modifications to Cython that provide a "pure Python"[1] approa

Re: 2to3 Help?

2009-01-14 Thread marco . m . petersen
> I don't yet have 3.0 installed, but my guess is you'll also need to > have 'C:\Python30\Scripts' in your path as well. I'm assuming that's > where it resides, so check first. Its in C:\Python30\Tools\Scripts. Anyway it now works. C:\Documents and Settings\User>python C:\Python30\Tools\Scripts

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-14 Thread Paul Rubin
Michele Simionato writes: > I would be fine having something like pylint built-in in the language > and running at every change of the source code (unless disabled with a > command line switch). I think this is the only reasonable solution to > get some additional protection we can hope for. A tru

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-14 Thread Russ P.
On Jan 14, 10:40 pm, "James Mills" wrote: > On Thu, Jan 15, 2009 at 4:34 PM, Michele > Simionato wrote: > > (...) > > > There are lots of Python developers (and most of the core developers) > > that think the OO community is wrong about enforced encapsulation. > > Personally, I think in a few yea

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-14 Thread Paul Rubin
Michele Simionato writes: > > there is no language that currently really works the right way, > > but some of them including Python are (one hopes) moving in good > > directions. > > To be fair, this has been true for the last 50 years. If a language > that works the right way really existed, CS

Re: 2to3 Help?

2009-01-14 Thread alex23
On Jan 15, 4:52 pm, marco.m.peter...@gmail.com wrote: > Oh okay. I don't think my Python installation is in PATH yet. I'll try > to add it then. I don't yet have 3.0 installed, but my guess is you'll also need to have 'C:\Python30\Scripts' in your path as well. I'm assuming that's where it resides

Re: 2to3 Help?

2009-01-14 Thread marco . m . petersen
Oh okay. I don't think my Python installation is in PATH yet. I'll try to add it then. -- http://mail.python.org/mailman/listinfo/python-list

Re: 2to3 Help?

2009-01-14 Thread alex23
On Jan 15, 4:32 pm, marco.m.peter...@gmail.com wrote: > I tried to run it on the command prompt (I use Windows XP) but it > doesn't work either. > '$' is not recognized as an internal or external command, > operable program or batch file. '$' is used in the instructions to denote a command prompt.

Re: why o/p is different ???

2009-01-14 Thread James Mills
On Thu, Jan 15, 2009 at 4:34 PM, asit wrote: > I recently faced a peculiar o/p. > > My objective is to remove the command name(my script name) from > sys.argv[0]. > I coded like this If you _really_ want to remove your script_name from sys.argv, then do this: del sys.argv[0] If you're just afte

Re: why o/p is different ???

2009-01-14 Thread Pierre Bourdon
Use os.path.basename : >>> os.path.basename('/foo/bar/baz.py') 'baz.py' It will have the expected behavior on each system. You could also use os.sep instead of '/' in your split method call, but os.path.basename is more elegant. On Thu, Jan 15, 2009 at 7:34 AM, asit wrote: > I recently faced a

Re: why o/p is different ???

2009-01-14 Thread alex23
On Jan 15, 4:34 pm, asit wrote: > apppath = sys.argv[0].split("/") > appname = apppath[len(apppath)-1] I'd replace these two lines with the following: import os.path # at the top of the file, of course appname = os.path.basename(sys.argv[0]) Also note that you can use negative indices in li

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-14 Thread Michele Simionato
On Jan 15, 7:38 am, "James Mills" wrote: > > If one is a clumsy programmer, then perhaps > one ought to be using a language that holds one's hand. Yes, and I use Python because it is a language that holds my hand, otherwise I would use C and enjoy segmentation faults all the time. -- http://mail.

Re: 2to3 Help?

2009-01-14 Thread James Mills
On Thu, Jan 15, 2009 at 4:32 PM, wrote: > I tried to run it on the command prompt (I use Windows XP) but it > doesn't work either. I did not realize you were using WIndows :) Normally most shells in the UNIX/Linux world start with a '$'. > I opened the command prompt: > > C:\Documents and Setti

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-14 Thread James Mills
On Thu, Jan 15, 2009 at 4:34 PM, Michele Simionato wrote: (...) > There are lots of Python developers (and most of the core developers) > that think the OO community is wrong about enforced encapsulation. > Personally, I think in a few years everybody will realize the mistake > of enforced encaps

why o/p is different ???

2009-01-14 Thread asit
I recently faced a peculiar o/p. My objective is to remove the command name(my script name) from sys.argv[0]. I coded like this import urllib import sys print "\n\n\t\tlipun4u[at]gmail[dot]com" print "\t\t" apppath = sys.argv[0].split("/") appname = apppath[len(apppath)

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-14 Thread James Mills
On Thu, Jan 15, 2009 at 4:20 PM, Michele Simionato wrote: (...) > I would be fine having something like pylint built-in in the language > and running at every change of the source code (unless disabled with a > command line switch). I think this is the only reasonable solution to > get some addit

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-14 Thread Michele Simionato
On Jan 14, 4:18 am, "Russ P." wrote: > > So I can claim that Python is not strictly object oriented until it > gets encapsulation (in the sense of data hiding). That is simply a > fact, and no amount of pleading or obfuscation will change it. > > Should Python get true encapsulation? I don't know.

Re: 2to3 Help?

2009-01-14 Thread marco . m . petersen
> You need to do 2 things: > > 1) Run 2to3 on the shell not the python interpreter. > 2) Learn some basic UNIX. > > cheers > James I tried to run it on the command prompt (I use Windows XP) but it doesn't work either. I opened the command prompt: C:\Documents and Settings\User> Then I typed '$

Re: Suggested improvements for IDLE (non-official)

2009-01-14 Thread Terry Reedy
r wrote: On Jan 14, 4:43 pm, Terry Reedy wrote: [snip] I think the 'main' IDLE maintainer is no longer active. I think someone who would do more than fix critical bugs might be welcome. Hello Terry, That's what i was beginning to think. I am not quite ready (as far as my skills are concerned

Re: Python 3 isinstance

2009-01-14 Thread Steven D'Aprano
On Wed, 14 Jan 2009 22:03:37 -0500, Lambert, David W (S&T) wrote: > Overly terse. I do mean that this is illegal: > > isinstance(s, {str, bytes}) *shrug* Just change the {} to () and it will work fine. Or do this: isinstance(s, tuple({str, bytes})) > tuples have order, immutability, and t

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-14 Thread Michele Simionato
On Jan 14, 3:27 am, Paul Rubin wrote:> > I don't understand why some folks spew such violent rhetoric against > the idea of augmenting Python with features to alert you automatically > when you depart from the convention, so that you can check that the > departure is

Re: 2to3 Help?

2009-01-14 Thread James Mills
On Thu, Jan 15, 2009 at 4:17 PM, wrote: $ 2to3.py testscript.py > File "", line 1 >$ 2to3.py testscript.py >^ > Syntax Error: Invalid Syntax Oh i see... You need to do 2 things: 1) Run 2to3 on the shell not the python interpreter. 2) Learn some basic UNIX. cheers James -- http://

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-14 Thread Steven D'Aprano
On Thu, 15 Jan 2009 16:07:46 +1000, James Mills wrote: > On Thu, Jan 15, 2009 at 3:59 PM, Michele Simionato > wrote: > (...) > >> It could just be an issue of practicality. Python is an industrial >> strength language with libraries for everything and you can use it for >> your daily work. There

Re: 2to3 Help?

2009-01-14 Thread marco . m . petersen
On Jan 15, 2:09 pm, "James Mills" wrote: > On Thu, Jan 15, 2009 at 4:01 PM,   wrote: > > I have Python 3.0. I tried to use the 2to3 program included with the > > interpreter to convert some scripts for Python 2.5 to Python 3.0 ones. > > When I try to start it form the Python command line, it says

Re: 2to3 Help?

2009-01-14 Thread James Mills
On Thu, Jan 15, 2009 at 4:01 PM, wrote: > I have Python 3.0. I tried to use the 2to3 program included with the > interpreter to convert some scripts for Python 2.5 to Python 3.0 ones. > When I try to start it form the Python command line, it says it is a > syntax error. > > This was the line of c

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-14 Thread James Mills
On Thu, Jan 15, 2009 at 3:59 PM, Michele Simionato wrote: (...) > It could just be an issue of practicality. Python is an industrial > strength language with libraries for everything and you can use it for > your daily work. There are nice little languages out there that are > however not usable

2to3 Help?

2009-01-14 Thread marco . m . petersen
I have Python 3.0. I tried to use the 2to3 program included with the interpreter to convert some scripts for Python 2.5 to Python 3.0 ones. When I try to start it form the Python command line, it says it is a syntax error. This was the line of code: $ 2to3 testscript.py Any help would be appreci

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-14 Thread Michele Simionato
On Jan 13, 6:47 pm, Bruno Desthuilliers wrote: > I really wonder why peoples that seems to dislike one of the central > features of Python - it's dynamism - still use it (assuming of course > they are free to choose another language). And FWIW, I at least had a > partial answer on this. It could

Re: executing multiple functions in background simultaneously

2009-01-14 Thread Steve Holden
Jean-Paul Calderone wrote: > On Wed, 14 Jan 2009 17:11:44 -0800, Catherine Moroney > wrote: >> [snip] >>> >>> The easy thing is to use a Queue object. The background thread uses >>> .put() to place a computed result on the QUeue and the caller uses >>> .get() to read from the queue. There's an ass

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-14 Thread Rhodri James
On Thu, 15 Jan 2009 03:54:02 -, Paul Rubin <"http://phr.cx"@nospam.invalid> wrote: "Rhodri James" writes: > Again, there have to be some language extensions to communicate the > necessary info to the external tool. Or, dare one say it, conventions? If the language-tool combo uses the

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-14 Thread Michele Simionato
On Jan 13, 2:48 am, "Russ P." wrote: > I started looking at Scala a while back. It is has many nice features. > It seamlessly combines object orientation with advanced functional > programming. I don't like that. Scala was designed with the idea of putting together the two worlds, by I think the

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-14 Thread Russ P.
On Jan 14, 9:04 pm, "James Mills" wrote: Oh, by the way, please quit emailing me every time you reply to one of my posts. You're the only one here who does that, and it isn't necessary. Thanks. -- http://mail.python.org/mailman/listinfo/python-list

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-14 Thread Michele Simionato
On Jan 12, 10:58 pm, Paul Rubin wrote: > We are in an era for programming languages sort of like the Windows 95 > era was for operating systems, where everything is broken but some of > the fixes are beginning to come into view.  So there is no language > that current

Re: Python 3 isinstance

2009-01-14 Thread Terry Reedy
Lambert, David W (S&T) wrote: Overly terse. I do mean that this is illegal: isinstance(s, {str, bytes}) tuples have order, immutability, and the possibility of repeat items. A set is most reasonable in a mathematical sense. I agree. However, isinstance predates set. Hence the status quo.

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-14 Thread Russ P.
On Jan 14, 9:04 pm, "James Mills" wrote: > On Thu, Jan 15, 2009 at 2:50 PM, Russ P. wrote: > > (..) > > > One feature of Ada that I always thought was a good idea is the > > distinction between functions and procedures, where functions are > > guaranteed to not have side effects. But I don't thin

Re: Python Crashes

2009-01-14 Thread koranthala
On Jan 15, 3:12 am, "James Mills" wrote: > On Thu, Jan 15, 2009 at 6:57 AM, koranthala wrote: > > Hi, > >    I have a twisted based application based on Python 2.4.3. I also > > have one thread in this application. > > >    I found that my program crashes repeatedly after a random interval > > (r

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-14 Thread Michele Simionato
On Jan 14, 8:16 pm, Paul Rubin wrote: > I have a situation which I face almost every day, where I have some > gigabytes of data that I want to slice and dice somehow and get some > numbers out of.  I spend 15 minutes writing a one-off Python program > and then several

Re: SOAPpy under Python 2.6

2009-01-14 Thread Terry Reedy
le...@leithalweapon.geek.nz wrote: I am having problems with SOAPpy after we upgraded to Python 2.6 Here is the exception I keep getting: File "C:\Dev\Phoenix\SAPI.py", line 2561, in getSystemInfo obj = self.soapProxy.getSystemInfo() File "c:\python26\Lib\site-packages\SOAPpy\Client.py"

SOAPpy under Python 2.6

2009-01-14 Thread leith
I am having problems with SOAPpy after we upgraded to Python 2.6 Here is the exception I keep getting: File "C:\Dev\Phoenix\SAPI.py", line 2561, in getSystemInfo obj = self.soapProxy.getSystemInfo() File "c:\python26\Lib\site-packages\SOAPpy\Client.py", line 470, in __call__ return se

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-14 Thread Paul Rubin
"Russ P." writes: > I think we need to distinguish here between purely functional > languages and a languages that support functional programming. I would > be even more averse to a purely functional language than I am to a > purely OO language such as Java. I guess I'm not sure what you're consi

Re: Python 3 isinstance

2009-01-14 Thread John Machin
On Jan 15, 2:03 pm, "Lambert, David W (S&T)" wrote: > Overly terse. I do mean that this is illegal: > > isinstance(s, {str, bytes}) > > tuples have order, immutability, and the possibility of repeat items. In the anticipated/usual use case (the type/class names are hard- coded): * order is a ver

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-14 Thread James Mills
On Thu, Jan 15, 2009 at 2:50 PM, Russ P. wrote: (..) > One feature of Ada that I always thought was a good idea is the > distinction between functions and procedures, where functions are > guaranteed to not have side effects. But I don't think Ada allows > advanced functional programming such as

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-14 Thread Russ P.
On Jan 14, 7:37 pm, Paul Rubin wrote: > "James Mills" writes: > > In fact, Python borrows features from the Functional Paradigm. Does > > this make it a Functional Language ? No. Why ? Because one of the > > clear requirements of the Functional Paradigm is that funct

Re: are there some special about '\x1a' symbol

2009-01-14 Thread R Fritz
Raps cane on floor. It's probably an "end-of-file" sentinel because 'Z' is the last letter of the alphabet. I suspect it comes from MIT. Unix, developed at a telephone company, uses \x4, which was, in fact, the ASCII in-band end-of-transmission code and would disconnect a teletype. Does this

Re: executing multiple functions in background simultaneously

2009-01-14 Thread Cameron Simpson
On 14Jan2009 17:11, Catherine Moroney wrote: > Cameron Simpson wrote: >> On 14Jan2009 15:50, Catherine Moroney >> wrote: >>> James Mills wrote: On Wed, Jan 14, 2009 at 11:02 AM, Catherine Moroney wrote: > I would like to spawn off multiple instances of a function > and run the

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-14 Thread Paul Rubin
Steve Holden writes: > Sometimes I just want to shout "be quiet, Python is just fine the way it > is", but alas your objections are usually too sensible to be dismissed > in that way. In the long term I feel it has to be good for Python that > it has such conscientious critics. Thanks for the kin

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-14 Thread Paul Rubin
"Rhodri James" writes: > > Again, there have to be some language extensions to communicate the > > necessary info to the external tool. > > Or, dare one say it, conventions? If the language-tool combo uses the info in a formal way, they are extensions, not conventions. -- http://mail.python.org/

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-14 Thread Paul Rubin
"Russ P." writes: > I started looking at Scala a while back. It is has many nice features. > It seamlessly combines object orientation with advanced functional > programming. It is statically typed, but the types often do not need > to be explicitly declared. It is fully "compatible" with Java, bu

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-14 Thread Rhodri James
On Wed, 14 Jan 2009 16:34:36 -, Paul Rubin <"http://phr.cx"@nospam.invalid> wrote: Terry Reedy writes: The question is where such checks should be. Guido prefers separate checkers (PyChecker, PyLint) rather than in the interpreter. Again, there have to be some language extensions to co

Re: Re: problem calling method

2009-01-14 Thread Rhodri James
On Wed, 14 Jan 2009 10:54:21 -, wrote: The parent is called like this (I didn't copy that line): def __init__(self, *args, **kwds): # begin wxGlade: MyFrame.__init__ kwds["style"] = wx.DEFAULT_FRAME_STYLE wx.Frame.__init__(self, *args, **kwds) The frame works fine and so do

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-14 Thread Rhodri James
On Wed, 14 Jan 2009 09:09:37 -, Russ P. wrote: Yes, that would indeed be nice. I am certainly not the only one who could use a language that is excellent for both research prototyping *and* the final, safety-critical system. Then perhaps the prototype could just be cleaned up and "hardened"

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-14 Thread Paul Rubin
"James Mills" writes: > In fact, Python borrows features from the Functional Paradigm. Does > this make it a Functional Language ? No. Why ? Because one of the > clear requirements of the Functional Paradigm is that functions > cannot have side affects. I'd say functional programming emphasizes a

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-14 Thread Paul Rubin
Scott David Daniels writes: > But, the research on the language "Self" shows that even in the face > of a language with more dynamism than Smalltalk (or Python), performance > can be obtained using compiler technology. It turns out you don't have > to type those type any extra keystrokes. Compil

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-14 Thread Paul Rubin
Bruno Desthuilliers writes: > > We're not talking about libraries here. > > Yes we are. If the default is "non-dynamic", then a class author is in > charge of explicitely allowing it when *he* see fits. Oh, I see what you mean, the standard libraries would be affected if the language default wer

Re: Python 3 isinstance

2009-01-14 Thread James Mills
On Thu, Jan 15, 2009 at 1:03 PM, Lambert, David W (S&T) wrote: > Overly terse. I do mean that this is illegal: > > isinstance(s, {str, bytes}) > > tuples have order, immutability, and the possibility of repeat items. > > A set is most reasonable in a mathematical sense. What's wrong with: >>> a

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-14 Thread Paul Rubin
alex23 writes: > Paul, have you looked into Cython at all? I've only used it trivially > but it does seem to provide the potential for static typing & improve > compile time checking (as well as increased performance) while > retaining as Pythonic a representation as possible. I haven't. Maybe I

Re: Python 3 isinstance

2009-01-14 Thread
Overly terse. I do mean that this is illegal: isinstance(s, {str, bytes}) tuples have order, immutability, and the possibility of repeat items. A set is most reasonable in a mathematical sense. -- http://mail.python.org/mailman/listinfo/python-list

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-14 Thread alex23
On Jan 15, 5:16 am, Paul Rubin wrote: > I would be ecstatic with a version of Python where I might have to > spend 20 minutes instead of 15 minutes writing the program, but then > it runs in half an hour instead of several hours and doesn't crash. Paul, have you look

General direction

2009-01-14 Thread MLT
Hello all: I'm a beginner to Python (and programming altogether), and am now looking to create a program of my own. What I've got in mind is a very basic pest control program that would keep track of 1) trap findings and 2) pesticides. My thought is to make each of these classes. Looking at the

Re: initialising a class by name

2009-01-14 Thread Steven D'Aprano
On Wed, 14 Jan 2009 13:53:52 +0530, Krishnakant wrote: > Hi steevan, > I liked this idea of dispatchTable. > is it possible to say some thing like inst = dispatchTable{"ham"} > according to me, inst will become the instance of class ham. Yes, that works, provided you fix the syntax. (You used {

Re: Getting around immutable default arguments for recursion

2009-01-14 Thread alex23
dpapathanasiou wrote: > Passing the entire dictionary to every function that accesses it is > better? If there are a large number of functions, you could combine them and the history_db dict into a single object. -- http://mail.python.org/mailman/listinfo/python-list

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-14 Thread Paul Rubin
Luis Zarrabeitia writes: > Wait, do you _really_ believe that _static_ checks could prevent problems > arising from _unexpected_ conditions in the _data_? The data does not arrive from outer space on a magtape stapled to a meteor. It comes out of another program. Most of the problems in process

Re: Getting around immutable default arguments for recursion

2009-01-14 Thread Steven D'Aprano
On Wed, 14 Jan 2009 15:27:01 -0800, dpapathanasiou wrote: >> a) a global should and need not be used. > > Passing the entire dictionary to every function that accesses it is > better? Yes. There is very little overhead when passing objects to functions in Python. There's no performance penalty

Re: reverse dict lookup & Relation class

2009-01-14 Thread MRAB
Aaron Brady wrote: Hi, this is a continuation of something that comes up now and again about reverse lookups on dictionaries, as well as a follow-up to my pursuit of a Relation class from earlier. For a reverse lookup, you just need two lookups. name= {} phone= {} name[ '555-963' ]= 'Joan' pho

process/thread instances and attributes

2009-01-14 Thread James Mills
Hey all, I have this concept I'm working on and here is the code... Problem is if you run this it doesn't terminate. I believe you can terminate it in the main process by calling a.stop() But I can't find a way for it to self terminate, ie: self.stop() As indicated by the code...

Re: executing multiple functions in background simultaneously

2009-01-14 Thread James Mills
Speaking of Threading .. http://codepad.org/dvxwAphE Just a really interesting way of doing this :) cheers James -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: executing multiple functions in background simultaneously

2009-01-14 Thread Catherine Moroney
On Jan 14, 2009, at 5:20 PM, Jean-Paul Calderone wrote: On Wed, 14 Jan 2009 17:11:44 -0800, Catherine Moroney wrote: [snip] The easy thing is to use a Queue object. The background thread uses .put() to place a computed result on the QUeue and the caller uses .get() to read from the queue. T

Invitation for Python at the Southern California Linux Expo

2009-01-14 Thread joe
Greetings, I would like to invite the Python project to attend the 7th Southern California Linux Expo. The show will be held February 20th-22nd, 2009 at the Westin LAX in Los Angeles, CA. SCALE 7x will be an excellent venue to increase awareness and showcase the work of the Python community. Ea

Re: executing multiple functions in background simultaneously

2009-01-14 Thread Jean-Paul Calderone
On Wed, 14 Jan 2009 17:11:44 -0800, Catherine Moroney wrote: [snip] The easy thing is to use a Queue object. The background thread uses .put() to place a computed result on the QUeue and the caller uses .get() to read from the queue. There's an assortment of other ways too. Cheers, Thank y

Re: executing multiple functions in background simultaneously

2009-01-14 Thread Catherine Moroney
Cameron Simpson wrote: On 14Jan2009 15:50, Catherine Moroney wrote: James Mills wrote: On Wed, Jan 14, 2009 at 11:02 AM, Catherine Moroney wrote: I would like to spawn off multiple instances of a function and run them simultaneously and then wait until they all complete. [...] Try using th

Re: reverse dict lookup & Relation class

2009-01-14 Thread Chris Rebert
On Wed, Jan 14, 2009 at 4:30 PM, Aaron Brady wrote: > Hi, this is a continuation of something that comes up now and again > about reverse lookups on dictionaries, as well as a follow-up to my > pursuit of a Relation class from earlier. > > For a reverse lookup, you just need two lookups. > name= {

Re: executing multiple functions in background simultaneously

2009-01-14 Thread Aaron Brady
On Jan 14, 6:00 pm, Cameron Simpson wrote: > On 14Jan2009 15:50, Catherine Moroney > wrote: > > > James Mills wrote: > >> On Wed, Jan 14, 2009 at 11:02 AM, Catherine Moroney > >> wrote: > >>> I would like to spawn off multiple instances of a function > >>> and run them simultaneously and then w

reverse dict lookup & Relation class

2009-01-14 Thread Aaron Brady
Hi, this is a continuation of something that comes up now and again about reverse lookups on dictionaries, as well as a follow-up to my pursuit of a Relation class from earlier. For a reverse lookup, you just need two lookups. name= {} phone= {} name[ '555-963' ]= 'Joan' phone[ 'Joan' ]= '555-963'

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-14 Thread Luis Zarrabeitia
Quoting Paul Rubin <"http://phr.cx"@NOSPAM.invalid>: > Often, the Python program crashes halfway through, even though I > tested it on a few megabytes of data before starting the full > multi-gigabyte run, because it hit some unexpected condition in the > data that could have been prevented with

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-14 Thread Paul Rubin
Steven D'Aprano writes: > Not accidental, but people complain if you use slots for the purpose of > prohibiting attribute creation. They say "That's not what __slots__ was > designed for!". That's okay though, computers were designed for breaking > Germany ciphers and calculating the trajectory

Re: executing multiple functions in background simultaneously

2009-01-14 Thread Cameron Simpson
On 14Jan2009 15:50, Catherine Moroney wrote: > James Mills wrote: >> On Wed, Jan 14, 2009 at 11:02 AM, Catherine Moroney >> wrote: >>> I would like to spawn off multiple instances of a function >>> and run them simultaneously and then wait until they all complete. [...] >> Try using the python st

Re: python3.0 MySQLdb

2009-01-14 Thread Daniel Fetchinson
> Daniel> Well, this actually is the case: MySql has not been ported. As > Daniel> far as I can see the mysql python module in general (meaning for > Daniel> the 2.x branch) is not as well maintained as some others and > Daniel> questions about windows vs. linux issues periodically

Re: executing multiple functions in background simultaneously

2009-01-14 Thread Catherine Moroney
James Mills wrote: On Wed, Jan 14, 2009 at 11:02 AM, Catherine Moroney wrote: I would like to spawn off multiple instances of a function and run them simultaneously and then wait until they all complete. Currently I'm doing this by calling them as sub-processes executable from the command-line.

Re: LGPL license for Qt 4.5

2009-01-14 Thread Robert Kern
Carl Banks wrote: On Jan 14, 6:57 am, sturlamolden wrote: According to a Norwegian publication, Nokia will release Qt under LGPL as of version 4.5. If I had stocks in Riverbank Computing ltd., I would sell them now... For the rest of us, this is fantastic news. http://digi.no/php/art.php?id=

Re: Getting around immutable default arguments for recursion

2009-01-14 Thread James Mills
On Thu, Jan 15, 2009 at 9:27 AM, dpapathanasiou wrote: > Without the "if priors:" line just above the first return statement (a > typo perhaps?), then yes, it would do what I want. Yes sorry it was :) >> a) a global should and need not be used. > > Passing the entire dictionary to every function

Re: Getting around immutable default arguments for recursion

2009-01-14 Thread dpapathanasiou
> How about this then: > > def get_prior_versions (item_id, priors=None): >"""Return a list of all prior item ids starting with this one""" >global history_db # key = item id, value = prior item id >prior_id = history_db[item_id] >if not prior_id: >if priors: >retur

Re: Getting around immutable default arguments for recursion

2009-01-14 Thread dpapathanasiou
> You'll continue to be confused if you use that term. Python already > has a specific use of the term “immutable”, and it doesn't apply > here. I was just following the terminology used in "A Byte of Python" (which, that particular point aside, is a very good tutorial). > Better to say: default

Re: Suggested improvements for IDLE (non-official)

2009-01-14 Thread r
On Jan 14, 4:43 pm, Terry Reedy wrote: [snip] > I think the 'main' IDLE maintainer is no longer active.  I think someone > who would do more than fix critical bugs might be welcome. Hello Terry, That's what i was beginning to think. I am not quite ready (as far as my skills are concerned) to put

Re: can someone tell me why this doesn't work please python 3

2009-01-14 Thread Steven D'Aprano
On Wed, 14 Jan 2009 09:45:58 -0800, Dennis Lee Bieber wrote: > Personally -- I'd accept anything that started with the character: > > while True: > password = input(prompt).lower() > if password.startswith("y"): > return True >

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-14 Thread Steven D'Aprano
On Wed, 14 Jan 2009 08:45:46 -0800, Paul Rubin wrote: >> Btw, for performance, there is __slots__, > > That is a good point, we somehow lost sight of that in this thread. > >> with the side-effect that it forbids attribute creation 'on the fly'. > > I have had the impression that this is a some

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-14 Thread Steven D'Aprano
On Wed, 14 Jan 2009 20:33:01 +0100, Bruno Desthuilliers wrote: > Paul Rubin a écrit : >> Bruno Desthuilliers >> writes: I haven't anywhere in this thread as far as I know suggested eliminating dynamism from Python, >>> Nope, but your suggestion would have the same practical result as fa

Re: Getting around immutable default arguments for recursion

2009-01-14 Thread James Mills
On Thu, Jan 15, 2009 at 8:32 AM, dpapathanasiou wrote: (...) > It's not exactly right for what I'm doing, b/c the caller always > expects a list in return. How about this then: def get_prior_versions (item_id, priors=None): """Return a list of all prior item ids starting with this one"""

Re: Python 3 isinstance

2009-01-14 Thread Carl Banks
On Jan 14, 4:14 pm, "Lambert, David W (S&T)" wrote: > Please, why isn't a set permitted as the second argument to isinstance? The Python development team might be open to adding it if you were to submit a patch. The use case is fairly obvious. I doubt any of them would respond to a wishlist req

Re: Suggested improvements for IDLE (non-official)

2009-01-14 Thread Terry Reedy
James Stroud wrote: r wrote: I actually like the IDLE, but it could use a few improvements. If anybody else has suggestions by all means post them. 1.) The text widget and the prompt(>>>) should be separated. Trying to write a conditional in the interactive IDLE is a real PITA. Not to mention i

Re: Getting around immutable default arguments for recursion

2009-01-14 Thread Ben Finney
dpapathanasiou writes: > But every subsequent call returned the results of the prior call, > plus the results of the current call. > > I was confused until I read in the docs that default arguments are > immutable. You'll continue to be confused if you use that term. Python already has a specif

Re: LGPL license for Qt 4.5

2009-01-14 Thread Carl Banks
On Jan 14, 6:57 am, sturlamolden wrote: > According to a Norwegian publication, Nokia will release Qt under LGPL > as of version 4.5. > > If I had stocks in Riverbank Computing ltd., I would sell them now... > > For the rest of us, this is fantastic news. > > http://digi.no/php/art.php?id=800922

Re: Getting around immutable default arguments for recursion

2009-01-14 Thread dpapathanasiou
> How about: > > def get_prior_versions (item_id, priors=None): >"""Return a list of all prior item ids starting with this one""" >global history_db # key = item id, value = prior item id >prior_id = history_db[item_id] >if not prior_id: >return priors >else: >i

Re: Getting around immutable default arguments for recursion

2009-01-14 Thread dpapathanasiou
> The usual solution is: > > def get_prior_versions (item_id, priors=None): > if priors is None: > priors = [] Thanks! -- http://mail.python.org/mailman/listinfo/python-list

Re: Suggested improvements for IDLE (non-official)

2009-01-14 Thread r
Hello James, I actually want to trash IDLE and start over. I would be willing to do a complete re-write. I have already made a template GUI that works (early stages). I am wondering if anyone else might be interested in taking this on with me? IMO IDLE is full of fluff where it should not be, and t

Re: Getting around immutable default arguments for recursion

2009-01-14 Thread James Mills
On Thu, Jan 15, 2009 at 8:11 AM, dpapathanasiou wrote: > I wrote this function to retrieve a list of items from a dictionary. > > The first time it was called, it worked properly. > > But every subsequent call returned the results of the prior call, plus > the results of the current call. > > I wa

  1   2   3   >