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

2009-01-14 Thread Luis Zarrabeitia
On Tuesday 13 January 2009 10:32:54 pm James Mills wrote: > Should Python get strict and enforce access control > of object members ? No. Why ? I can think of several > reasons. > > Give me one use-case where you strictly require > that members of an object be private and their > access enforced as

point class help

2009-01-14 Thread r
I am hacking up a point class but having problems with how to properly overload some methods. in the __add__, __sub__, __iadd__, __isub__, I want to have the option of passing an instance or a container(list, tuple) like >>> p1 = Point2d(10,10) >>> p1 += (10,10) >>> p1 Point2d(20,20) >>> >>> p2 =

Re: pep 8 constants

2009-01-14 Thread Albert Hopkins
On Wed, 2009-01-14 at 16:58 +1000, James Mills wrote: [...] > Still I would avoid using this idiom altogether > and jsut stick with default values. For Example: > > FOO = 1 > > def f(x=FOO): >... > > > Use this instead: > > def f(x=1): >... That only works well when "1" is only used o

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

2009-01-14 Thread Paul Rubin
Luis Zarrabeitia writes: > when you need to share some objects with potentially untrusted code (like, a > plugin system). You can't, and you shouldn't, expect that the user will know > what plugins he should or shouldn't load, and you shouldn't blame him/her > when your app stops working becaus

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

2009-01-14 Thread Luis Zarrabeitia
On Wednesday 14 January 2009 12:57:42 am James Mills wrote: > Russ: > > 1. Quit while you're ahead. > 2. OOP is encapsulating data and functionality into a single grouping > (object). > 3. Other features more recently developed by OO languages such as > Polymorphism, Access Control (a type of enc

Re: Why this code is working?

2009-01-14 Thread Mel
Hussein B wrote: > On Jan 14, 11:55 am, Bruno Desthuilliers 42.desthuilli...@websiteburo.invalid> wrote: >> Hussein B a écrit : >> >> > Hey, >> > Why this code is working? >> >> def f1( ): >> > ...      x = 88 >> > ...      f2(x) >> > ... >> def f2(x): >> > ...      print x >> > ... >>

Re: Why this code is working?

2009-01-14 Thread Steve Holden
Diez B. Roggisch wrote: > r wrote: > >> Listen Hussien, > > Granted, with a name of "r", spelling it wrong is hard, and thus you might > not be trained in the art of spelling names proper. But I suggest you try > your best. After all, you posts lack so much in content, you could at least > excel

Re: point class help

2009-01-14 Thread r
before anybody say's anything, i screwed up when i pasted the code, here is what i really have... def method(self, other): if isinstance(other, Point2d): x, y = other.x, other.y else: x, y = other[0], other[1] return self.x+x, self.y+y #and the fixed class :) class Po

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

2009-01-14 Thread Paul Rubin
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 communicate the necessary info to the external tool. Python 3.0 begins to do that, but a

Re: MySQLdb LIKE '%%%s%%' problem

2009-01-14 Thread Steve Holden
John Machin wrote: > On Jan 14, 9:42 pm, Steve Holden wrote: > >> 3. I can't be certain my experience with PostgreSQL extends to MySQl, >> but I have done experiments which prove to my satisfaction that it isn't >> possible to parameterize LIKE arguments. So the only way to do it >> appears to be

Re: 'Import sys' succeeds in C++ embedded code, but module is not fully visible

2009-01-14 Thread Ivan Illarionov
On Jan 14, 1:49 pm, Ben Sizer wrote: > No, I don't want to do anything with sys.path apart from see it. I > just wanted my original question answered, not a guess at my intent > and a solution for something I'm not doing. ;)  Thanks though! > > Again - why can I not reference sys from within the f

Re: point class help

2009-01-14 Thread Steve Holden
r wrote: > I am hacking up a point class but having problems with how to properly > overload some methods. in the __add__, __sub__, __iadd__, __isub__, I > want to have the option of passing an instance or a container(list, > tuple) like > p1 = Point2d(10,10) p1 += (10,10) p1 > Poin

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

2009-01-14 Thread Paul Rubin
Luis Zarrabeitia writes: > Why don't you do it backwards? > You *can* implement a metaclass that will remove the dynasmism from its > instances. Do it - I can give you a starting point if you wish. That's kind of interesting, how does it work? > But most of us are very happy with the dynamic na

Mod_python, jsonrpc and sessions

2009-01-14 Thread p3dda . adam
Hi, I've got a python web-application being served by apache via mod_python, in which the users sessions are tracked via the mod_python Session module. Some of websites generated contain a java-script function which starts a jsonrpc call to the same server and gets further data or stores something

Mod_python, jsonrpc and sessions

2009-01-14 Thread p3dda . adam
Hi, I've got a python web-application being served by apache via mod_python, in which the users sessions are tracked via the mod_python Session module. Some of websites generated contain a java-script function which starts a jsonrpc call to the same server and gets further data or stores something

Re: os system command not found

2009-01-14 Thread codicedave
On 14 Gen, 15:30, Daniel da Silva wrote: > On Jan 14, 5:25 am, codicedave wrote: > > > > > Hi all! > > I installed a external program called infomap using the classical > > procedure > > > ./configure > > make > > sudo make install > > >  and it works perfectly in Terminal (Os x) using both bash

Re: point class help

2009-01-14 Thread r
On Jan 14, 10:44 am, Steve Holden wrote: > Thous it does seem particularly perverse to have the add method not > itself return a Point. Thanks Steve, i was going implement exactly this but thought there "might" be a better way i did not know about. So i feel better about myself already. And your

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

2009-01-14 Thread Bruno Desthuilliers
Paul Rubin a écrit : Bruno Desthuilliers writes: If the programmer could somehow disallow it in certain classes, Already possible - you just have to provide your own implementation of __setattr__. Part of the idea of non-dynamic attribute sets is to make the program run faster, not slower.

RE: Weird behaviour re: Python on Windows

2009-01-14 Thread Kevin Jing Qiu
It's run as Administrator. The problem here is why it behaves differently when in debug mode or interactive shell than in the non-debug mode? -Original Message- From: python-list-bounces+kevin.jingqiu=caseware@python.org [mailto:python-list-bounces+kevin.jingqiu=caseware@python.o

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

2009-01-14 Thread Bruno Desthuilliers
Paul Rubin a écrit : "James Mills" writes: You do realize this is a model and not strictly a requirement. Quite a few things in Python are done merely by convention. Don't get caught up. But, if something is done by convention, then departing from the convention is by definition unconventiona

Re: Why this code is working?

2009-01-14 Thread Roger
On Jan 14, 8:08 am, r wrote: > I guess where i come from > freedom is second nature so i took to python pretty quick. Wow, that's presumptive, assuming, and harsh. Not at all helpful and unnecessary. Geez... -- http://mail.python.org/mailman/listinfo/python-list

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

2009-01-14 Thread Paul Rubin
Bruno Desthuilliers writes: > Russ argument was about "good engineering", not about raw perfs. FWIW, > _you_ may be willing to trade dynamism for raw perfs, but there are > probably some people here that won't agree. Obviously there will never be total unanimity about every tiny thing. I haven't

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

2009-01-14 Thread Luis Zarrabeitia
On Wednesday 14 January 2009 11:18:51 am Paul Rubin wrote: > Luis Zarrabeitia writes: > > when you need to share some objects with potentially untrusted code > > (like, a plugin system). You can't, and you shouldn't, expect that the > > user will know what plugins he should or shouldn't load, and

Re: 'Import sys' succeeds in C++ embedded code, but module is not fully visible

2009-01-14 Thread Ben Sizer
On Jan 14, 4:37 pm, Ivan Illarionov wrote: > > I would try to use ourNamespace_ dict for > both globals and locals in PyRun_String call. I will try it when I get home. However I would like to be able to treat them as separate dictionaries, as I want to be able to import some symbols and modules a

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

2009-01-14 Thread Paul Rubin
Bruno Desthuilliers writes: > Given that the convention for "protected" attributes in Python is to > prefix them with an underscore, I fail to see how one could > "accidentally" mess with implementation details. Typing a leading > underscore is rarely a typo. We are talking about the accidental c

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

2009-01-14 Thread Bruno Desthuilliers
Paul Rubin a écrit : "James Mills" writes: Python is a dynamic object oriented language ... (almost verbatim from the website). It is compiled to bytecode and run on a virtual machine. 1. There is nothing inherent about dynamic languages that prevents them from being compiled. There are com

Re: 'Import sys' succeeds in C++ embedded code, but module is not fully visible

2009-01-14 Thread Ivan Illarionov
On Jan 14, 8:00 pm, Ben Sizer wrote: > I will try it when I get home. However I would like to be able to > treat them as separate dictionaries, as I want to be able to import > some symbols and modules at a global level, but be able to clear out > objects introduced at the local level on a periodi

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

2009-01-14 Thread Luis Zarrabeitia
On Wednesday 14 January 2009 11:45:46 am Paul Rubin wrote: > Luis Zarrabeitia writes: > > Why don't you do it backwards? > > You *can* implement a metaclass that will remove the dynasmism from its > > instances. Do it - I can give you a starting point if you wish. > > That's kind of interesting, h

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

2009-01-14 Thread Paul Rubin
Bruno Desthuilliers writes: > > But those occasions are rare enough that having to > > enable the feature by saying (e.g.) "@dynamic" before the class > > definition doesn't seem like a problem, > > This imply that you (as the library author) pretend to know by advance > when your users (programm

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

2009-01-14 Thread Bruno Desthuilliers
Russ P. a écrit : On Jan 13, 7:32 pm, "James Mills" wrote: On Wed, Jan 14, 2009 at 1:18 PM, Russ P. wrote: Yes, but the fact that you can approximate OO programming in a particular language does not make that language object oriented. You can approximate OO programming in C, but that does not

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

2009-01-14 Thread Paul Rubin
Bruno Desthuilliers writes: > You'll find successful "monster" projects written in > languages that are even more permissive than Python (C anyone ?), Could you name one written in C? Anyway, C is far less safe than Python in some ways, but has lots more compile time checking. -- http://mail.pyt

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

2009-01-14 Thread Scott David Daniels
Gary M. Josack wrote: Ben Kaplan wrote: On Jan 14, 2009, at 9:44 AM, "Gary M. Josack" wrote: garywood wrote: def ask_ok(prompt, retries=4, complaint="Yes or no, please!"): while True: password = input("enter something") if password in ('y', 'ye', 'yes'): return True if

Re: 'Import sys' succeeds in C++ embedded code, but module is not fully visible

2009-01-14 Thread Ivan Illarionov
On Jan 14, 8:17 pm, Ivan Illarionov wrote: > On Jan 14, 8:00 pm, Ben Sizer wrote: > > > I will try it when I get home. However I would like to be able to > > treat them as separate dictionaries, as I want to be able to import > > some symbols and modules at a global level, but be able to clear ou

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

2009-01-14 Thread Luis Zarrabeitia
On Wednesday 14 January 2009 12:54:13 pm Paul Rubin wrote: > Bruno Desthuilliers writes: > > You'll find successful "monster" projects written in > > languages that are even more permissive than Python (C anyone ?), > > Could you name one written in C? hmm... http://kernel.org -- Luis Zarrabe

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

2009-01-14 Thread Paul Rubin
Luis Zarrabeitia writes: > > > You'll find successful "monster" projects written in > > > languages that are even more permissive than Python (C anyone ?), > > > > Could you name one written in C? > > hmm... http://kernel.org That project may be successful in terms of having a lot of users, bu

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

2009-01-14 Thread Bruno Desthuilliers
Paul Rubin a écrit : Bruno Desthuilliers writes: Russ argument was about "good engineering", not about raw perfs. FWIW, _you_ may be willing to trade dynamism for raw perfs, but there are probably some people here that won't agree. Obviously there will never be total unanimity about every tin

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

2009-01-14 Thread Paul Rubin
Carl Banks writes: > Guess what systems I worked on that didn't even use scoping? I wrote > code for the GP7000 (equipped on some Airbus 380s) and the F-136 > (which will be equipped on some F-35 fighters) engine controllers. > Neither one used any data hiding. The language was C (not C++), but

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

2009-01-14 Thread Paul Rubin
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 far > as I'm concerned. Sorry, I don't comprehend that. The rest of your post makes no sense a

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

2009-01-14 Thread Benjamin Kaplan
On Wed, Jan 14, 2009 at 1:13 PM, Paul Rubin <"http://phr.cx"@nospam.invalid>wrote: > Luis Zarrabeitia writes: > > > > You'll find successful "monster" projects written in > > > > languages that are even more permissive than Python (C anyone ?), > > > > > > Could you name one written in C? > > > >

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

2009-01-14 Thread Russ P.
On Jan 14, 1:54 am, Carl Banks wrote: > I thought you were done wasting time with this nonsense. So did I. > > An engine *simulation* is one > > thing; the actual engine control code is another. > > Guess what systems I worked on that didn't even use scoping?  I wrote > code for the GP7000 (equ

Preserving file permissions with distutils

2009-01-14 Thread George Sakkis
I'm trying to use distutils to install some package data and additional files, some of which may be executable. It turns out that distutils does not preserve the permissions. Digging in the code, there is the following comment on distutils/command/build_py: # XXX copy_file by default prese

Re: python3.0 MySQLdb

2009-01-14 Thread gert
On Jan 13, 11:58 pm, "Martin v. Löwis" wrote: > Steve Holden wrote: > > Daniel Fetchinson wrote: > >>> I need something to connect to a database, preferably mysql, that > >>> works in python3.0 please. > >> And your question is? > > > Surely it's fairly obvious that the question is "does such a th

Re: urllib2 - 403 that _should_ not occur.

2009-01-14 Thread ajaksu
On Jan 14, 5:14 am, Steve Holden wrote: > ajaksu wrote: >> [snip evangelism stuff] > OK, but be aware that the PSF doesn't monitor the bugs looking for > actions to take on behalf of the Python user community. In fact we > aren't overtly "political" in this way at all. This doesn't mean it > would

Re: LGPL license for Qt 4.5

2009-01-14 Thread Mike Driscoll
On Jan 14, 8:20 am, sturlamolden wrote: > On Jan 14, 3:11 pm, "drobi...@gmail.com" wrote: > > > On Jan 14, 7: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 w

Re: python3.0 MySQLdb

2009-01-14 Thread Martin v. Löwis
> So the final questions was, is there anything els on the menu besides > PostgreSQL, like MySql for example ? There is sqlite3 also; it is included in Python 3. Otherwise, I don't think any other DB-API compliant database connectors have been ported to Python 3 yet; it may take many months until

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

2009-01-14 Thread Paul Rubin
"Russ P." writes: > I know some researchers in software engineering who believe that the > ultimate solution to software reliability is automatic code > generation. The don't really care much which language is used, because > it would only be an intermediate form that humans don't interact with >

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

2009-01-14 Thread Scott David Daniels
Paul Rubin wrote: I haven't anywhere in this thread as far as I know suggested eliminating dynamism from Python, which would be in "that's not Python any more" territory. But, in the dozens of class definitions I write in any given day of coding, I might use the dynamism we're talking abou

Suggested improvements for IDLE (non-official)

2009-01-14 Thread r
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 if you copy the working code snip

Re: point class help

2009-01-14 Thread Matimus
On Jan 14, 8:50 am, r wrote: > On Jan 14, 10:44 am, Steve Holden wrote: > > > Thous it does seem particularly perverse to have the add method not > > itself return a Point. > > Thanks Steve, > i was going implement exactly this but thought there "might" be a > better way i did not know about. So

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

2009-01-14 Thread Bruno Desthuilliers
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 far as I'm concerned. Sorry, I don't comprehend that. IIRC, your suggestion was

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

2009-01-14 Thread Bruno Desthuilliers
Paul Rubin a écrit : Bruno Desthuilliers writes: But those occasions are rare enough that having to enable the feature by saying (e.g.) "@dynamic" before the class definition doesn't seem like a problem, This imply that you (as the library author) pretend to know by advance when your users (pr

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

2009-01-14 Thread Bruno Desthuilliers
Paul Rubin a écrit : Bruno Desthuilliers writes: Given that the convention for "protected" attributes in Python is to prefix them with an underscore, I fail to see how one could "accidentally" mess with implementation details. Typing a leading underscore is rarely a typo. We are talking about

Python Crashes

2009-01-14 Thread koranthala
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 (ranging from 10 min to 3 hr). When I say crash, it is not just that the program dies. Rather in WinXP - a window com

Re: Python Crashes

2009-01-14 Thread Philip Semanchuk
On Jan 14, 2009, at 3:57 PM, 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 (ranging from 10 min to 3 hr). When I say crash, it is not just that

pythonic chew toyz (a column, by K. Urner) v.1 n.1

2009-01-14 Thread kirby.ur...@gmail.com
Selena spotted me right away as "the O'Reilly spy", me agreeing she had an exceptionally good memory, maybe we could recruit her? Our banter traces to the first meeting on OS Bridge and how I introduced myself [0], not yet realizing Allison Randal was in the audience (way more an insider, as to ho

pythonic chew toyz (a column, by K. Urner) v.1 n.1

2009-01-14 Thread kirby.ur...@gmail.com
Selena spotted me right away as "the O'Reilly spy", me agreeing she had an exceptionally good memory, maybe we could recruit her? Our banter traces to the first meeting on OS Bridge and how I introduced myself [0], not yet realizing Allison Randal was in the audience (way more an insider, as to ho

Re: Mod_python, jsonrpc and sessions

2009-01-14 Thread lkcl
On Jan 14, 4:47 pm, p3dda.a...@googlemail.com wrote: > Hi, > > I've got a python web-application being served by apache via > mod_python, in which the users sessions are tracked via the mod_python > Session module. > Some of websites generated contain a java-script function which starts > a jsonrpc

QT4

2009-01-14 Thread Stephen Chapman
Hey, looks like Nokia bought Qt and solved the Open Source/Commercial license issue: http://rss.slashdot.org/~r/Slashdot/slashdot/~3/A4br-rQA460/article.pl I wonder if pyqt will follow suit... -- http://mail.python.or

Re: executing multiple functions in background simultaneously

2009-01-14 Thread brooklineTom
> The disadvantage of threads in Python (CPython, actually) is that > there's the GIL (Global Interpreter Lock), so you won't get any speed > advantage if the threads are mostly processor-bound. On a single processor machine with compute-bound threads, I don't the GIL is the bottleneck. No matter

Re: Suggested improvements for IDLE (non-official)

2009-01-14 Thread James Stroud
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 if you copy the workin

Re: python3.0 MySQLdb

2009-01-14 Thread Daniel Fetchinson
>> >>> I need something to connect to a database, preferably mysql, that >> >>> works in python3.0 please. >> >> And your question is? >> >> > Surely it's fairly obvious that the question is "does such a thing >> > exist, and if so where can I find it?". >> >> Interestingly enough, the question was

Re: urllib2 - 403 that _should_ not occur.

2009-01-14 Thread Steve Holden
ajaksu wrote: > On Jan 14, 5:14 am, Steve Holden wrote: >> ajaksu wrote: >>> [snip evangelism stuff] >> OK, but be aware that the PSF doesn't monitor the bugs looking for >> actions to take on behalf of the Python user community. In fact we >> aren't overtly "political" in this way at all. This do

Re: change only the nth occurrence of a pattern in a string

2009-01-14 Thread MRAB
Antoon Pardon wrote: > On 2008-12-31, TP wrote: >> Hi everybody, >> >> I would like to change only the nth occurence of a pattern in a string. The >> problem with "replace" method of strings, and "re.sub" is that we can only >> define the number of occurrences to change from the first one. >>

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

2009-01-14 Thread Steve Holden
Paul Rubin wrote: > "Russ P." writes: >> I know some researchers in software engineering who believe that the >> ultimate solution to software reliability is automatic code >> generation. The don't really care much which language is used, because >> it would only be an intermediate form that human

Re: Python Crashes

2009-01-14 Thread James Mills
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 > (ranging from 10 min to 3 hr). When I say crash, it is n

Python 3 isinstance

2009-01-14 Thread
Please, why isn't a set permitted as the second argument to isinstance? -- http://mail.python.org/mailman/listinfo/python-list

Getting around immutable default arguments for recursion

2009-01-14 Thread dpapathanasiou
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 was confused until I read in the docs that default arguments are immuta

Re: Python 3 isinstance

2009-01-14 Thread James Mills
On Thu, Jan 15, 2009 at 8:14 AM, Lambert, David W (S&T) wrote: > Please, why isn't a set permitted as the second argument to isinstance? Care to show us a code sample ? We're not psychic you know... cheers James -- http://mail.python.org/mailman/listinfo/python-list

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

2009-01-14 Thread Brian Allen Vanderburg II
rt8...@gmail.com wrote: Here is a piece of C code this same guy showed me saying Pythonic indention would make this hard to read -- Well lets see then! I swear, before god, this is the exact code he showed me. If you don't believe me i will post a link to the thread. // Warning ugly C code ahe

Re: Python 3 isinstance

2009-01-14 Thread MRAB
Lambert, David W (S&T) wrote: Please, why isn't a set permitted as the second argument to isinstance? Do you mean set as a class ("isinstance(s, set)", which is valid) or a set of classes ("isinstance(s, set([str, bytes])", which isn't valid)? -- http://mail.python.org/mailman/listinfo/python-l

Re: LGPL license for Qt 4.5

2009-01-14 Thread excord80
On Jan 14, 9:20 am, sturlamolden wrote: > > In either case, Qt will be available under the same licensing terms as > wxWidgets. > > As of today, the main reason to prefer wxPython over PyQt is the > license. With an LGPL'd Qt, I'd rather ask what this will mean for > wxPython. wx has a nice commu

Re: Getting around immutable default arguments for recursion

2009-01-14 Thread MRAB
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 was confused until I read in the docs that defa

Re: python3.0 MySQLdb

2009-01-14 Thread skip
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 come up

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

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 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: 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: 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 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: 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: 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: 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: 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: 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: 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: 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: 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: 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 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: 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: 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: 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 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: 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: 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

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: 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

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 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: 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

<    1   2   3   >