Re: [Python-3000] More PEP 3101 changes incoming

2007-08-03 Thread Adam Olsen
On 8/3/07, Adam Olsen <[EMAIL PROTECTED]> wrote: > class MyFloat: > def __format__(self, type, ...): > if type == 'D': > return custom format > else: > return float(self).__format__(type, ...) Oops, explicitly falling back to float is unnecessary here.

[Python-3000] map() Returns Iterator

2007-08-03 Thread Kurt B. Kaiser
Although there has been quite a bit of discussion on dropping reduce() and retaining map(), filter(), and zip(), there has been less discussion (at least that I can find) on changing them to return iterators instead of lists. I think of map() and filter() as sequence transformers. To me, it's an

Re: [Python-3000] More PEP 3101 changes incoming

2007-08-03 Thread Adam Olsen
On 8/3/07, Talin <[EMAIL PROTECTED]> wrote: > Ron Adam wrote: > > After a fair amount of experimenting today, I think I've found a nice > > middle ground that meets some of what both you and Guido are looking > > for. (And a bit my own preference too.) > > First off, thank you very much for taking

[Python-3000] patch for csv test failures

2007-08-03 Thread Adam Hupp
I've uploaded a patch to SF[0] that fixes the csv struni test failures. The patch also implements unicode support in the _csv C module. Some questions: 1. The CSV PEP (305) lists Unicode support as a TODO. Is there a particular person I should talk to have this change reviewed? 2. PEP 7 (C

Re: [Python-3000] More PEP 3101 changes incoming

2007-08-03 Thread Ron Adam
Talin wrote: > What's missing, however, is a description of how all of this interacts > with the __format__ hook. The problem we are facing right now is > sometimes we want to override the __format__ hook and sometimes we > don't. Right now, the model that we want seems to be: > > 1) High

Re: [Python-3000] optimizing [x]range

2007-08-03 Thread Lisandro Dalcin
On 8/2/07, Stargaming <[EMAIL PROTECTED]> wrote: > >> made into an O(1) operation. here's a demo code (it should be trivial > >> to implement this in CPython) > [snipped algorithm] Did you taked into account that your patch is not backward compatible with py2.5?? Just try to do this with your patc

Re: [Python-3000] socket makefile bug

2007-08-03 Thread Guido van Rossum
On 8/3/07, Jeremy Hylton <[EMAIL PROTECTED]> wrote: > On 8/3/07, Guido van Rossum <[EMAIL PROTECTED]> wrote: > > The docs are out of date, we don't dup() any more (that was needed > > only because we were using fdopen()). But what *should* happen is that > > when you close the file object the socke

Re: [Python-3000] More PEP 3101 changes incoming

2007-08-03 Thread Ron Adam
Guido van Rossum wrote: > I have no time for a complete response, but a few quickies: > > - The more I think about it the, more I think putting knowledge of > floating point formatting into the wrapper is wrong. I really think we > should put this into float.__format__ (and int.__format__, and >

Re: [Python-3000] More PEP 3101 changes incoming

2007-08-03 Thread Ron Adam
Talin wrote: > Ron Adam wrote: >> After a fair amount of experimenting today, I think I've found a nice >> middle ground that meets some of what both you and Guido are looking >> for. (And a bit my own preference too.) > > First off, thank you very much for taking the time to think about th

Re: [Python-3000] text_zipimport fix

2007-08-03 Thread Guido van Rossum
I've checked this in as r56707. It looks fine at cursory inspection; if someone wants to test the handling of encodings more thoroughly, be my guest. --Guido On 8/3/07, Paul Colomiets <[EMAIL PROTECTED]> wrote: > Hi, > > I've just uploaded patch that fixes test_zipimport. > http://www.python.org/

Re: [Python-3000] More PEP 3101 changes incoming

2007-08-03 Thread Guido van Rossum
I have no time for a complete response, but a few quickies: - The more I think about it the, more I think putting knowledge of floating point formatting into the wrapper is wrong. I really think we should put this into float.__format__ (and int.__format__, and Decimal.__format__). I can't find a r

Re: [Python-3000] optimizing [x]range

2007-08-03 Thread Guido van Rossum
On 8/3/07, Stargaming <[EMAIL PROTECTED]> wrote: > On Thu, 02 Aug 2007 15:25:36 -0700, Guido van Rossum wrote: > > > On 8/2/07, "Martin v. Löwis" <[EMAIL PROTECTED]> wrote: > >> > The patch is based on the latest trunk/ checkout, Python 2.6. I don't > >> > think this is a problem if nobody else mad

Re: [Python-3000] removing __members__ and __methods__

2007-08-03 Thread Guido van Rossum
Yes, they should all go. Expect some cleanup though! On 8/2/07, Neal Norwitz <[EMAIL PROTECTED]> wrote: > __members__ and __methods__ are both deprecated as of 2.2 and there is > the new __dir__. Is there any reason to keep them? I don't notice > anything in PEP 3100, but it seems like they shou

Re: [Python-3000] socket makefile bug

2007-08-03 Thread Jeremy Hylton
On 8/3/07, Guido van Rossum <[EMAIL PROTECTED]> wrote: > The docs are out of date, we don't dup() any more (that was needed > only because we were using fdopen()). But what *should* happen is that > when you close the file object the socket is still open. The socket > wrapper's close() method shoul

Re: [Python-3000] socket makefile bug

2007-08-03 Thread Guido van Rossum
The docs are out of date, we don't dup() any more (that was needed only because we were using fdopen()). But what *should* happen is that when you close the file object the socket is still open. The socket wrapper's close() method should be fixed. I can look into that later today. On 8/3/07, Jerem

Re: [Python-3000] More PEP 3101 changes incoming

2007-08-03 Thread Talin
Ron Adam wrote: > After a fair amount of experimenting today, I think I've found a nice > middle ground that meets some of what both you and Guido are looking > for. (And a bit my own preference too.) First off, thank you very much for taking the time to think about this in such detail. There a

[Python-3000] socket makefile bug

2007-08-03 Thread Jeremy Hylton
I'm looking into httplib problems on the struni branch. One unexpected problem is that socket.makefile() is not behaving correctly. The docs say "The file object references a dup()ped version of the socket file descriptor, so the file object and socket object may be closed or garbage-collected ind

Re: [Python-3000] optimizing [x]range

2007-08-03 Thread Stargaming
On Thu, 02 Aug 2007 15:25:36 -0700, Guido van Rossum wrote: > On 8/2/07, "Martin v. Löwis" <[EMAIL PROTECTED]> wrote: >> > The patch is based on the latest trunk/ checkout, Python 2.6. I don't >> > think this is a problem if nobody else made any effort towards making >> > xrange more sequence-like

Re: [Python-3000] More PEP 3101 changes incoming

2007-08-03 Thread Ron Adam
Talin wrote: > (I should also mention that "a:b,c" looks prettier to my eye than > "a,b:c". There's a reason for this, and its because of Python syntax. > Now, in Python, ':' isn't an operator - but if it was, you would have to > consider its precedence to be very low. Because when we look at

[Python-3000] text_zipimport fix

2007-08-03 Thread Paul Colomiets
Hi, I've just uploaded patch that fixes test_zipimport. http://www.python.org/sf/1766592 I'm still in doubt of some str/bytes issues. Fix me if I'm wrong. 1. imp.get_magic() should return bytes 2. loader.get_data() should return bytes 3. loader.get_source() should return str with encoding given f