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

2011-01-03 Thread Victor Stinner
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, esc).decode('iso-8859-1') def run_with_cgi(application):

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

2011-01-03 Thread Guido van Rossum
On Mon, Jan 3, 2011 at 9:52 AM, David Malcolm wrote: > On Sun, 2011-01-02 at 19:18 -0800, Guido van Rossum wrote: >> On Sun, Jan 2, 2011 at 5:50 PM, Alex Gaynor wrote: >> > No, it's singularly impossible to prove that any global load will be any >> > given >> > value at compile time.  Any optimi

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

2011-01-03 Thread Guido van Rossum
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). This would match the behavior of e.g. '%04d' % y when y > . If that means the platform libc asctime/ctime can't be used, too bad. --Guido On Mon, Jan

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

2011-01-03 Thread Alexander Belopolsky
There are several reports of bugs caused by the fact that the behavior of C functions asctime and ctime is undefined when they are asked to format time for more than 4-digit years: http://bugs.python.org/issue8013 http://bugs.python.org/issue6608 (closed) http://bugs.python.org/issue10563 (superse

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

2011-01-03 Thread David Malcolm
On Sun, 2011-01-02 at 19:18 -0800, Guido van Rossum wrote: > On Sun, Jan 2, 2011 at 5:50 PM, Alex Gaynor wrote: > > No, it's singularly impossible to prove that any global load will be any > > given > > value at compile time. Any optimization based on this premise is wrong. > > True. > > My pr

Re: [Python-Dev] Tools/unicode

2011-01-03 Thread Michael Foord
On 03/01/2011 16:19, M.-A. Lemburg wrote: Michael Foord wrote: On 03/01/2011 15:39, Alexander Belopolsky wrote: On Mon, Jan 3, 2011 at 10:33 AM, Michael Foord wrote: .. If someone knows if this tool is still used/useful then please let us know how the description should best be updated. If t

Re: [Python-Dev] Tools/unicode

2011-01-03 Thread M.-A. Lemburg
Michael Foord wrote: > On 03/01/2011 15:39, Alexander Belopolsky wrote: >> On Mon, Jan 3, 2011 at 10:33 AM, Michael >> Foord wrote: >> .. >>> If someone knows if this tool is still used/useful then please let us >>> know >>> how the description should best be updated. If there are no replies I'll

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

2011-01-03 Thread Guido van Rossum
On Mon, Jan 3, 2011 at 6:12 AM, Glyph Lefkowitz wrote: > Wouldn't this optimization break things like mocking out 'open' for testing > via 'module.open = fakeopen'?  I confess I haven't ever wanted to change > 'len' but that one seems pretty useful. I am explicitly excluding open from this opti

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

2011-01-03 Thread Guido van Rossum
On Sun, Jan 2, 2011 at 9:36 PM, Terry Reedy wrote: > On 1/2/2011 10:18 PM, Guido van Rossum wrote: > >> My proposed way out of this conundrum has been to change the language >> semantics slightly so that global names which (a) coincide with a >> builtin, and (b) have no explicit assignment to them

Re: [Python-Dev] Tools/unicode

2011-01-03 Thread Michael Foord
On 03/01/2011 15:39, Alexander Belopolsky wrote: On Mon, Jan 3, 2011 at 10:33 AM, Michael Foord wrote: .. If someone knows if this tool is still used/useful then please let us know how the description should best be updated. If there are no replies I'll remove it. If you are talking about Tool

Re: [Python-Dev] Tools/unicode

2011-01-03 Thread Alexander Belopolsky
On Mon, Jan 3, 2011 at 10:33 AM, Michael Foord wrote: .. > If someone knows if this tool is still used/useful then please let us know > how the description should best be updated. If there are no replies I'll > remove it. If you are talking about Tools/unicode/, this is definitely a very useful t

[Python-Dev] Tools/unicode

2011-01-03 Thread Michael Foord
Hello all, In the Tools/ directory (py3k) we have a tool/directory called "unicode". The description in Tools/README is: unicode Tools used to generate unicode database files for Python 2.0 (by Fredrik Lundh). As described this is not at all useful for Python 3.2. I'm

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

2011-01-03 Thread Glyph Lefkowitz
On Jan 2, 2011, at 10:18 PM, Guido van Rossum wrote: > On Sun, Jan 2, 2011 at 5:50 PM, Alex Gaynor wrote: >> No, it's singularly impossible to prove that any global load will be any >> given >> value at compile time. Any optimization based on this premise is wrong. > > True. > > My proposed

Re: [Python-Dev] [Python-checkins] r87677 - python/branches/py3k/py3rsa.py

2011-01-03 Thread Eric Smith
On 1/3/2011 4:47 AM, senthil.kumaran wrote: Author: senthil.kumaran Date: Mon Jan 3 10:47:09 2011 New Revision: 87677 Log: py3k implmentation of RSA algorithm, Added: python/branches/py3k/py3rsa.py (contents, props changed) Did you really mean this to go in the py3k top-level directo

Re: [Python-Dev] [Python-checkins] r87677 - python/branches/py3k/py3rsa.py

2011-01-03 Thread Senthil Kumaran
Sorry Folks. I commited to a wrong respository. I was testing it against the latest version py3k and I thought i moved it back to my original respository. Apologize for the trouble and I shall remove it immediately. -- Senthil On Mon, Jan 3, 2011 at 5:47 PM, senthil.kumaran wrote: > Author: se