Re: [Python-Dev] Possible optimization for LOAD_FAST ?

2011-01-04 Thread Michael Foord
On 04/01/2011 01:02, Guido van Rossum wrote: On Mon, Jan 3, 2011 at 9:52 AM, David Malcolmdmalc...@redhat.com wrote: On Sun, 2011-01-02 at 19:18 -0800, Guido van Rossum wrote: On Sun, Jan 2, 2011 at 5:50 PM, Alex Gaynoralex.gay...@gmail.com wrote: No, it's singularly impossible to prove

Re: [Python-Dev] PEP 3333: wsgi_string() function

2011-01-04 Thread Antoine Pitrou
On Tue, 04 Jan 2011 03:44:53 +0100 Victor Stinner victor.stin...@haypocalc.com wrote: def wsgi_string(u): # Convert an environment variable to a WSGI bytes-as-unicode string return u.encode(enc, esc).decode('iso-8859-1') def run_with_cgi(application): environ = {k:

Re: [Python-Dev] PEP 3333: wsgi_string() function

2011-01-04 Thread Victor Stinner
Le mardi 04 janvier 2011 à 13:20 +0100, Antoine Pitrou a écrit : On Tue, 04 Jan 2011 03:44:53 +0100 Victor Stinner victor.stin...@haypocalc.com wrote: def wsgi_string(u): # Convert an environment variable to a WSGI bytes-as-unicode string return u.encode(enc,

Re: [Python-Dev] PEP 3333: wsgi_string() function

2011-01-04 Thread Antoine Pitrou
On Tue, 04 Jan 2011 14:33:37 +0100 Victor Stinner victor.stin...@haypocalc.com wrote: Le mardi 04 janvier 2011 à 13:20 +0100, Antoine Pitrou a écrit : On Tue, 04 Jan 2011 03:44:53 +0100 Victor Stinner victor.stin...@haypocalc.com wrote: def wsgi_string(u): # Convert an environment

Re: [Python-Dev] Backport troubles with mercurial

2011-01-04 Thread Barry Warsaw
On Dec 30, 2010, at 02:50 AM, R. David Murray wrote: You are welcome; thanks for the feedback. (I sometimes feel like I'm working in a bit of a vacuum, though Barry does chime in occasionally...but I do realize that people are busy; that's why I inherited this job in the first place, after all

Re: [Python-Dev] Possible optimization for LOAD_FAST ?

2011-01-04 Thread Nick Coghlan
On Tue, Jan 4, 2011 at 8:49 PM, Michael Foord fuzzy...@voidspace.org.uk wrote: I think someone else pointed this out, but replacing builtins externally to a module is actually common for testing. In particular replacing the open function, but also other builtins, is often done temporarily to

Re: [Python-Dev] Possible optimization for LOAD_FAST ?

2011-01-04 Thread Guido van Rossum
On Tue, Jan 4, 2011 at 2:49 AM, Michael Foord fuzzy...@voidspace.org.uk wrote: I think someone else pointed this out, but replacing builtins externally to a module is actually common for testing. In particular replacing the open function, but also other builtins, is often done temporarily to

Re: [Python-Dev] Checking input range in time.asctime and time.ctime

2011-01-04 Thread Alexander Belopolsky
On Mon, Jan 3, 2011 at 7:47 PM, Guido van Rossum gu...@python.org wrote: Given the rule garbage in - garbage out, I'd do the most useful thing, which would be to produce a longer output string (and update the docs). I did not know that GIGO was a design rule, but after thinking about it some

Re: [Python-Dev] Possible optimization for LOAD_FAST ?

2011-01-04 Thread Nick Coghlan
On Wed, Jan 5, 2011 at 1:58 AM, Guido van Rossum gu...@python.org wrote: On Tue, Jan 4, 2011 at 2:49 AM, Michael Foord fuzzy...@voidspace.org.uk wrote: I think someone else pointed this out, but replacing builtins externally to a module is actually common for testing. In particular replacing

Re: [Python-Dev] Possible optimization for LOAD_FAST ?

2011-01-04 Thread Alex Gaynor
On Tue, Jan 4, 2011 at 10:20 AM, Nick Coghlan ncogh...@gmail.com wrote: On Wed, Jan 5, 2011 at 1:58 AM, Guido van Rossum gu...@python.org wrote: On Tue, Jan 4, 2011 at 2:49 AM, Michael Foord fuzzy...@voidspace.org.uk wrote: I think someone else pointed this out, but replacing builtins

Re: [Python-Dev] PEP 3333: wsgi_string() function

2011-01-04 Thread Tres Seaver
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 01/03/2011 09:44 PM, Victor Stinner wrote: Hi, In the PEP , I read: -- import os, sys enc, esc = sys.getfilesystemencoding(), 'surrogateescape' def wsgi_string(u): # Convert an environment variable to a WSGI

Re: [Python-Dev] PEP 3333: wsgi_string() function

2011-01-04 Thread P.J. Eby
At 03:44 AM 1/4/2011 +0100, Victor Stinner wrote: Hi, In the PEP , I read: -- import os, sys enc, esc = sys.getfilesystemencoding(), 'surrogateescape' def wsgi_string(u): # Convert an environment variable to a WSGI bytes-as-unicode string return u.encode(enc,

Re: [Python-Dev] Possible optimization for LOAD_FAST ?

2011-01-04 Thread Reid Kleckner
On Tue, Jan 4, 2011 at 8:21 AM, Alex Gaynor alex.gay...@gmail.com wrote: Ugh, I can't be the only one who finds these special cases to be a little nasty? Special cases aren't special enough to break the rules. Alex +1, I don't think nailing down a few builtins is that helpful for optimizing

Re: [Python-Dev] Possible optimization for LOAD_FAST ?

2011-01-04 Thread Barry Warsaw
On Jan 04, 2011, at 10:21 AM, Alex Gaynor wrote: Ugh, I can't be the only one who finds these special cases to be a little nasty? Special cases aren't special enough to break the rules. Yeah, I agree. Still it would be interesting to see what kind of performance improvement this would result

Re: [Python-Dev] Possible optimization for LOAD_FAST ?

2011-01-04 Thread Michael Foord
On 04/01/2011 16:54, Barry Warsaw wrote: On Jan 04, 2011, at 10:21 AM, Alex Gaynor wrote: Ugh, I can't be the only one who finds these special cases to be a little nasty? Special cases aren't special enough to break the rules. Yeah, I agree. Still it would be interesting to see what kind of

Re: [Python-Dev] Possible optimization for LOAD_FAST ?

2011-01-04 Thread Lukas Lueg
Doesnt this all boil down to being able to monitor PyDict for changes to it's key-space? The keys are immutable anyway so the instances of PyDict could manage a opaque value (in fact, a counter) that changes every time a new value is written to any key. Once we get a reference out of the dict, we

Re: [Python-Dev] Possible optimization for LOAD_FAST ?

2011-01-04 Thread Neil Schemenauer
Barry Warsaw ba...@python.org wrote: On Jan 04, 2011, at 10:21 AM, Alex Gaynor wrote: Ugh, I can't be the only one who finds these special cases to be a little nasty? Special cases aren't special enough to break the rules. Yeah, I agree. Still it would be interesting to see what kind of

Re: [Python-Dev] PEP 3333: wsgi_string() function

2011-01-04 Thread Guido van Rossum
On Tue, Jan 4, 2011 at 8:22 AM, Tres Seaver tsea...@palladion.com wrote: Note that Guido just recently wrote on that list that he considers that PEP to be de facto accepted. That was conditional on there not being any objections in the next 24 hours. There have been plenty, so I'm retracting

Re: [Python-Dev] Possible optimization for LOAD_FAST ?

2011-01-04 Thread Steven D'Aprano
Guido van Rossum wrote: On Tue, Jan 4, 2011 at 2:49 AM, Michael Foord fuzzy...@voidspace.org.uk wrote: I think someone else pointed this out, but replacing builtins externally to a module is actually common for testing. In particular replacing the open function, but also other builtins, is

Re: [Python-Dev] Possible optimization for LOAD_FAST ?

2011-01-04 Thread Guido van Rossum
On Tue, Jan 4, 2011 at 1:50 PM, Steven D'Aprano st...@pearwood.info wrote: I've been known to monkey-patch builtins in the interactive interpreter and in test code. One example that comes to mind is that I had some over-complicated recursive while loop (!), and I wanted to work out the Big Oh

Re: [Python-Dev] Possible optimization for LOAD_FAST ?

2011-01-04 Thread Daniel Stutzbach
On Tue, Jan 4, 2011 at 9:33 AM, Lukas Lueg lukas.l...@googlemail.comwrote: The keys are immutable anyway so the instances of PyDict could manage a opaque value (in fact, a counter) that changes every time a new value is written to any key. Once we get a reference out of the dict, we can can

Re: [Python-Dev] Possible optimization for LOAD_FAST ?

2011-01-04 Thread Guido van Rossum
On Tue, Jan 4, 2011 at 2:15 PM, Daniel Stutzbach stutzb...@google.com wrote: On Tue, Jan 4, 2011 at 9:33 AM, Lukas Lueg lukas.l...@googlemail.com wrote: The keys are immutable anyway so the instances of PyDict could manage a opaque value (in fact, a counter) that changes every time a new

Re: [Python-Dev] Possible optimization for LOAD_FAST ?

2011-01-04 Thread Steven D'Aprano
Guido van Rossum wrote: On Tue, Jan 4, 2011 at 1:50 PM, Steven D'Aprano st...@pearwood.info wrote: I've been known to monkey-patch builtins in the interactive interpreter and in test code. One example that comes to mind is that I had some over-complicated recursive while loop (!), and I wanted

Re: [Python-Dev] Possible optimization for LOAD_FAST ?

2011-01-04 Thread Lukas Lueg
I very much like the fact that python has *very* little black magic revealed to the user. Strong -1 on optimizing picked builtins in a picked way. 2011/1/4 Steven D'Aprano st...@pearwood.info: Guido van Rossum wrote: On Tue, Jan 4, 2011 at 2:49 AM, Michael Foord fuzzy...@voidspace.org.uk

Re: [Python-Dev] Possible optimization for LOAD_FAST ?

2011-01-04 Thread Guido van Rossum
On Tue, Jan 4, 2011 at 3:13 PM, Steven D'Aprano st...@pearwood.info wrote: Guido van Rossum wrote: But why couldn't you edit the source code? Because there was no source code -- I was experimenting in the interactive interpreter. I could have just re-created the function by using the readline

Re: [Python-Dev] Possible optimization for LOAD_FAST ?

2011-01-04 Thread Guido van Rossum
On Tue, Jan 4, 2011 at 2:13 PM, Lukas Lueg lukas.l...@googlemail.com wrote: I very much like the fact that python has *very* little black magic revealed to the user. Strong -1 on optimizing picked builtins in a picked way. That's easy for you to say. -- --Guido van Rossum (python.org/~guido)

Re: [Python-Dev] Possible optimization for LOAD_FAST ?

2011-01-04 Thread Michael Foord
On 04/01/2011 23:29, Guido van Rossum wrote: On Tue, Jan 4, 2011 at 3:13 PM, Steven D'Apranost...@pearwood.info wrote: Guido van Rossum wrote: But why couldn't you edit the source code? Because there was no source code -- I was experimenting in the interactive interpreter. I could have just

Re: [Python-Dev] Possible optimization for LOAD_FAST ?

2011-01-04 Thread Michael Foord
On 04/01/2011 23:29, Guido van Rossum wrote: On Tue, Jan 4, 2011 at 3:13 PM, Steven D'Apranost...@pearwood.info wrote: Guido van Rossum wrote: But why couldn't you edit the source code? Because there was no source code -- I was experimenting in the interactive interpreter. I could have just

Re: [Python-Dev] Possible optimization for LOAD_FAST ?

2011-01-04 Thread Guido van Rossum
On Tue, Jan 4, 2011 at 3:36 PM, Michael Foord fuzzy...@voidspace.org.uk wrote: The only examples I could find from a quick search (using the patch decorator from my mock module which is reasonably well used) patch __builtins__.open and raw_input.

[Python-Dev] Steroidal builtins (was: Possible optimization for LOAD_FAST ?)

2011-01-04 Thread skip
Steven I've been known to monkey-patch builtins in the interactive Steven interpreter and in test code. Me too. I use a slightly beefed up dir() funcion which identifies modules within a package which haven't been imported yet. Handy for quick-n-dirty introspection. import email

[Python-Dev] Started my PSF core grant today

2011-01-04 Thread Brett Cannon
For those of you who don't know, the PSF has given me a two month grant to work on the core. It's mostly focused on the long overdue overhaul of the dev docs (now being called the devguide) and writing a HOWTO on porting Python 2 code to Python 3. If I have time left over it will be spent on the

Re: [Python-Dev] Started my PSF core grant today

2011-01-04 Thread Raymond Hettinger
On Jan 4, 2011, at 4:36 PM, Brett Cannon wrote: For those of you who don't know, the PSF has given me a two month grant to work on the core. It's mostly focused on the long overdue overhaul of the dev docs (now being called the devguide) and writing a HOWTO on porting Python 2 code to Python

Re: [Python-Dev] [Python-checkins] devguide: Strip out all generic svn instructions from the FAQ. It's not only

2011-01-04 Thread Nick Coghlan
On Wed, Jan 5, 2011 at 5:55 AM, brett.cannon python-check...@python.org wrote: brett.cannon pushed 72a286c3452d to devguide: http://hg.python.org/devguide/rev/72a286c3452d changeset:   13:72a286c3452d user:        Brett Cannon br...@python.org date:        Tue Jan 04 11:48:38 2011 -0800

Re: [Python-Dev] [Python-checkins] devguide: Strip out all generic svn instructions from the FAQ. It's not only

2011-01-04 Thread Eli Bendersky
On Wed, Jan 5, 2011 at 04:13, Nick Coghlan ncogh...@gmail.com wrote: On Wed, Jan 5, 2011 at 5:55 AM, brett.cannon python-check...@python.org wrote: brett.cannon pushed 72a286c3452d to devguide: http://hg.python.org/devguide/rev/72a286c3452d changeset: 13:72a286c3452d user:

[Python-Dev] [issue8033] sqlite: broken long integer handling for arguments to user-defined functions

2011-01-04 Thread Phil Le Bienheureux
Hello, I am quite new to development in python, and as a first contribution to the community, I have provided a patch to the issue 8033 (quite trivial). I then ran the test suite an everything was ok. However, the status has not changed, and nobody has answered so far (patch provided one month