[Python-3000] map, filter, reduce

2007-06-01 Thread Jason Orendorff
PEP 3100 still isn't clear on the fate of these guys, except that reduce() is gone. How about moving all three to the functools module instead? -j ___ Python-3000 mailing list Python-3000@python.org http://mail.python.org/mailman/listinfo/python-3000 Un

Re: [Python-3000] map, filter, reduce

2007-06-01 Thread Steven Bethard
On 6/1/07, Jason Orendorff <[EMAIL PROTECTED]> wrote: > PEP 3100 still isn't clear on the fate of these guys, except that > reduce() is gone. > > How about moving all three to the functools module instead? The itertools module already has imap() and ifilter(). They can just be renamed to map() and

Re: [Python-3000] map, filter, reduce

2007-06-01 Thread Terry Reedy
"Jason Orendorff" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | PEP 3100 still isn't clear on the fate of these guys, except that | reduce() is gone. | | How about moving all three to the functools module instead? The current reduce is broken due to being a mashing together of tw

Re: [Python-3000] Lines breaking

2007-06-01 Thread Bill Janssen
> I agree that that looks nice in my editor, but it is not Unicode- > conforming practice, and I suspect that if you experiment with any > printer you'll discover that you get an empty line at the top of the > page. This seems to me to be a non-issue; most "text" files are actually data files (thi

Re: [Python-3000] Lines breaking

2007-06-01 Thread Bill Janssen
> The *only* thing that adoption of the Unicode recommendation for line > breaking changes is that "\x0c\n" is now two empty lines with well- > defined semantics instead of some number of lines with you-won't-know- > until-you-ask-the-implementation semantics. Well, that's just the way text is. >

Re: [Python-3000] map, filter, reduce

2007-06-01 Thread Collin Winter
On 6/1/07, Jason Orendorff <[EMAIL PROTECTED]> wrote: > PEP 3100 still isn't clear on the fate of these guys, except that > reduce() is gone. I'm not sure what isn't clear: reduce() is listed as "to be removed", and since map() and filter() aren't mentioned as "to be removed", they're presumably n

Re: [Python-3000] map, filter, reduce

2007-06-01 Thread Georg Brandl
Terry Reedy schrieb: > "Jason Orendorff" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > | PEP 3100 still isn't clear on the fate of these guys, except that > | reduce() is gone. > | > | How about moving all three to the functools module instead? > > The current reduce is broken d

[Python-3000] Error in PEP 3115?

2007-06-01 Thread Georg Brandl
In PEP 3115 (the new metaclasses PEP), there is an example metaclass: # The metaclass class OrderedClass(type): # The prepare function @classmethod def __prepare__(metacls, name, bases): # No keywords in this case return member_table()

Re: [Python-3000] map, filter, reduce

2007-06-01 Thread Jason Orendorff
On 6/1/07, Collin Winter <[EMAIL PROTECTED]> wrote: > On 6/1/07, Jason Orendorff <[EMAIL PROTECTED]> wrote: > > PEP 3100 still isn't clear on the fate of these guys, except that > > reduce() is gone. > > I'm not sure what isn't clear: reduce() is listed as "to be removed", > and since map() and fil

Re: [Python-3000] map, filter, reduce

2007-06-01 Thread Terry Reedy
"Georg Brandl" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | How should an "ireduce" work? The result is not a sequence which could be | returned lazily. It would generate the sequence of partial reductions (potentially indefinately). list(ireduce(summer, 0, range(5)) = [0, 1, 3

[Python-3000] Handling of wide Unicode characters

2007-06-01 Thread Alexandre Vassalotti
Hi, I was doing some testing on the new _string_io module, since I was slightly skeptical on my handling of wide Unicode characters (32-bit of length, instead of the usual 16-bit in UTF-16). So, I ran this little test: >>> s = _string_io.StringIO() >>> s.write(u'晉') >>> s.tell() 2 Li

Re: [Python-3000] Handling of wide Unicode characters

2007-06-01 Thread Josiah Carlson
"Alexandre Vassalotti" <[EMAIL PROTECTED]> wrote: > Hi, > > I was doing some testing on the new _string_io module, since I was > slightly skeptical on my handling of wide Unicode characters (32-bit > of length, instead of the usual 16-bit in UTF-16). So, I ran this > little test: > >>>> s =

Re: [Python-3000] map, filter, reduce

2007-06-01 Thread Guido van Rossum
I see no benefit in ireduce(), just more ways to write obfuscated code. Regarding map() and filter(), I don't see what's unclear about PEP 3100: """ * Make built-ins return an iterator where appropriate (e.g. ``range()``, ``zip()``, ``map()``, ``filter()``, etc.) [zip and range: done] """ --Gu

Re: [Python-3000] Error in PEP 3115?

2007-06-01 Thread Guido van Rossum
You're right. Fixed now. I also fixed dict.setitem (should be dict.__setitem__). Thanks for noticing! --Guido On 6/2/07, Georg Brandl <[EMAIL PROTECTED]> wrote: > In PEP 3115 (the new metaclasses PEP), there is an example metaclass: > > # The metaclass > class OrderedClass(type): > >

Re: [Python-3000] Handling of wide Unicode characters

2007-06-01 Thread Guido van Rossum
What he said. IOW, we're treating each half of a surrogate as a "character", at least for purposes of counting items in a string. (Otherwise operations like len() and indexing/slicing would no longer be O(1).) --Guido On 6/2/07, Josiah Carlson <[EMAIL PROTECTED]> wrote: > > "Alexandre Vassalotti"

Re: [Python-3000] Handling of wide Unicode characters

2007-06-01 Thread Alexandre Vassalotti
Thanks for explanation. Anyway, it certainly much simpler to deal with surrogate pairs than with variable-width characters. On 6/1/07, Josiah Carlson <[EMAIL PROTECTED]> wrote: > > "Alexandre Vassalotti" <[EMAIL PROTECTED]> wrote: > > Hi, > > > > I was doing some testing on the new _string_io modu

Re: [Python-3000] Lines breaking

2007-06-01 Thread Greg Ewing
Stephen J. Turnbull wrote: > Both FF and VT *are* whitespace, AFAIK that has universal > agreement, and in particular they *are* removed by string.strip(). You're right, strip() wasn't a good example, and I withdraw it. However, there's a big difference between being a whitespace character and be

Re: [Python-3000] map, filter, reduce

2007-06-01 Thread Greg Ewing
Terry Reedy wrote: > It would generate the sequence of partial reductions (potentially > indefinately). > list(ireduce(summer, 0, range(5)) = [0, 1, 3, 6, 10] > > This is obviously *not* the same as a reduce() which only returns the final > value without the intermediate values. It's sufficient

Re: [Python-3000] Handling of wide Unicode characters

2007-06-01 Thread Josiah Carlson
"Alexandre Vassalotti" <[EMAIL PROTECTED]> wrote: > Thanks for explanation. Anyway, it certainly much simpler to deal with > surrogate pairs than with variable-width characters. I don't know, I really liked my tree overlay that could handle variable-width characters of any internal encoding (utf-

Re: [Python-3000] Lines breaking

2007-06-01 Thread Stephen J. Turnbull
<[EMAIL PROTECTED]> <[EMAIL PROTECTED]> <[EMAIL PROTECTED]> <[EMAIL PROTECTED]> <[EMAIL PROTECTED]> <[EMAIL PROTECTED]> <[EMAIL PROTECTED]> <[EMAIL PROTECTED]> <[EMAIL PROTECTED]> <[EMAIL PROTECTED]> <07Jun1.111434pdt."

Re: [Python-3000] Support for PEP 3131

2007-06-01 Thread Rauli Ruohonen
On 5/27/07, Stephen J. Turnbull <[EMAIL PROTECTED]> wrote: >James Y Knight writes: >> a 'pyidchar.txt' file with a list of character ranges, and now that >> pyidchar.txt file is going to have separate sections based on module >> name? Sorry, but are you [EMAIL PROTECTED] kidding me?!? > >The scalab

Re: [Python-3000] Support for PEP 3131

2007-06-01 Thread Guillaume Proux
On 6/2/07, Rauli Ruohonen <[EMAIL PROTECTED]> wrote: > (1) Add a mandatory ASCII-only special comment at the beginning of > each module. The comment would continue until the first empty > line and would contain only valid directives matching some > regular expression. Only whitespace is