Re: [Python-3000] Need closure on __cmp__ removal

2008-01-06 Thread hashcollision
David A. Wheeler has already written a draft PEP, which can be found here: http://www.dwheeler.com/misc/pep-cmp.txt. ___ Python-3000 mailing list [email protected] http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.o

[Python-3000] Request for prod()

2008-01-06 Thread hashcollision
I request the addition of prod(): def prod(seq): s = 1 for x in seq: s *= x prod is always as useful as sum() ___ Python-3000 mailing list [email protected] http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http:/

Re: [Python-3000] [Python-Dev] Rounding Decimals

2008-01-06 Thread Jeffrey Yasskin
On Jan 5, 2008 7:11 PM, Raymond Hettinger <[EMAIL PROTECTED]> wrote: > > I think pep 3141's round(x, ndigits) does (1). The only thing it > > doesn't support yet is specifying the rounding mode. Perhaps the pep > > should say that round() passes any extra named arguments on to the > > __round__() m

[Python-3000] Default factory that uses key

2008-01-06 Thread hashcollision
The default factory that collections.defaultdict takes cannot use key. Is there a way to have the default factory take the key into consideration? For example d = collections.defaultdict(lambda title: BookShelf(title)) If not, I propose that it be added. _

Re: [Python-3000] Default factory that uses key

2008-01-06 Thread Georg Brandl
hashcollision schrieb: > The default factory that collections.defaultdict takes cannot use key. > Is there a way to have the default factory take the key into > consideration? For example > > d = collections.defaultdict(lambda title: BookShelf(title)) > > If not, I propose that it be added.

Re: [Python-3000] Request for prod()

2008-01-06 Thread Georg Brandl
hashcollision schrieb: > I request the addition of prod(): > > def prod(seq): > s = 1 > for x in seq: > s *= x > > prod is always as useful as sum() It would have to be called product(), and I believe it has been proposed multiple times and been rejected under the "not every

Re: [Python-3000] Request for prod()

2008-01-06 Thread Paul Moore
On 06/01/2008, Georg Brandl <[EMAIL PROTECTED]> wrote: > hashcollision schrieb: > > I request the addition of prod(): > It would have to be called product(), and I believe it has been proposed > multiple times and been rejected under the "not every 3-line function > has to be builtin" rule. Please

Re: [Python-3000] Request for prod()

2008-01-06 Thread Georg Brandl
Paul Moore schrieb: > On 06/01/2008, Georg Brandl <[EMAIL PROTECTED]> wrote: >> hashcollision schrieb: >> > I request the addition of prod(): >> It would have to be called product(), and I believe it has been proposed >> multiple times and been rejected under the "not every 3-line function >> has t

Re: [Python-3000] Request for prod()

2008-01-06 Thread Paul Moore
On 06/01/2008, Georg Brandl <[EMAIL PROTECTED]> wrote: > Paul Moore schrieb: > > On 06/01/2008, Georg Brandl <[EMAIL PROTECTED]> wrote: > >> hashcollision schrieb: > >> > I request the addition of prod(): > >> It would have to be called product(), and I believe it has been proposed > >> multiple ti

Re: [Python-3000] Request for prod()

2008-01-06 Thread Georg Brandl
Paul Moore schrieb: > On 06/01/2008, Georg Brandl <[EMAIL PROTECTED]> wrote: >> Paul Moore schrieb: >> > On 06/01/2008, Georg Brandl <[EMAIL PROTECTED]> wrote: >> >> hashcollision schrieb: >> >> > I request the addition of prod(): >> >> It would have to be called product(), and I believe it has bee

[Python-3000] py3k keyword is gone

2008-01-06 Thread Martin v. Löwis
As people had disliked the py3k keyword in the tracker, I have now changed all items that were still using it to use the Python 3.0 version instead, and retired that keyword. So please search for version "Python 3.0" if you want to see issues related to Python 3000. Regards, Martin __

Re: [Python-3000] [Python-Dev] Rounding Decimals

2008-01-06 Thread Jeffrey Yasskin
On Jan 6, 2008 1:21 AM, Jeffrey Yasskin <[EMAIL PROTECTED]> wrote: > On Jan 5, 2008 7:11 PM, Raymond Hettinger <[EMAIL PROTECTED]> wrote: > > > I think pep 3141's round(x, ndigits) does (1). The only thing it > > > doesn't support yet is specifying the rounding mode. Perhaps the pep > > > should sa

Re: [Python-3000] Request for prod()

2008-01-06 Thread Guido van Rossum
On Jan 6, 2008 1:19 AM, hashcollision <[EMAIL PROTECTED]> wrote: > I request the addition of prod(): > > def prod(seq): > s = 1 > for x in seq: > s *= x > > prod is always as useful as sum() No it isn't. This was discussed extensively at the time sum() was proposed and accepted

Re: [Python-3000] [Python-Dev] Rounding Decimals

2008-01-06 Thread Raymond Hettinger
FWIW, I don't think all of these patches are helpful. The implementations are so easy and the effects are so obvious, that it is simply better to decide what to do first, then do it afterwards. My own preference is to leave the decimal module alone (except for a __round__ method to be called b

Re: [Python-3000] [Python-Dev] Rounding Decimals

2008-01-06 Thread Jeffrey Yasskin
On Jan 6, 2008 5:13 PM, Raymond Hettinger <[EMAIL PROTECTED]> wrote: > FWIW, I don't think all of these patches are helpful. The implementations > are so easy and the effects are so obvious, that it is > simply better to decide what to do first, then do it afterwards. > > My own preference is to

Re: [Python-3000] [Python-Dev] Rounding Decimals

2008-01-06 Thread Raymond Hettinger
[Jeffrey Yasskin] > The other 3 methods > specified by PEP 3141 aren't strictly necessary for 2.6, but they will > be needed for 3.0. I'd rather not make the two versions of Decimal > gratuitously different, so this patch puts them in the 2.6 version > too. If I understand you correctly, then the

Re: [Python-3000] Need closure on __cmp__ removal

2008-01-06 Thread Guido van Rossum
On Jan 5, 2008 10:40 PM, hashcollision <[EMAIL PROTECTED]> wrote: > David A. Wheeler has already written a draft PEP, which can be found here: > http://www.dwheeler.com/misc/pep-cmp.txt. Thanks, I'd missed that. But alas, it's a bit short on the motivation for rich comparisons. For example it fai

Re: [Python-3000] [Python-Dev] Rounding Decimals

2008-01-06 Thread Guido van Rossum
On Jan 6, 2008 7:40 PM, Raymond Hettinger <[EMAIL PROTECTED]> wrote: > [Jeffrey Yasskin] > > The other 3 methods > > specified by PEP 3141 aren't strictly necessary for 2.6, but they will > > be needed for 3.0. I'd rather not make the two versions of Decimal > > gratuitously different, so this patc

Re: [Python-3000] [Python-Dev] Rounding Decimals

2008-01-06 Thread Raymond Hettinger
[Raymond] >> There should probably be a PEP sets clearer guidelines about what should be >> backported from Py3.0. >> >> Perhaps something like this: >> * If there is a new feature that can be implemented in both and will make >> both more attractive, then it should be in both. >> * If something

Re: [Python-3000] [Python-Dev] Rounding Decimals

2008-01-06 Thread Jeffrey Yasskin
On Jan 6, 2008 7:40 PM, Raymond Hettinger <[EMAIL PROTECTED]> wrote: > [Jeffrey Yasskin] > > The other 3 methods > > specified by PEP 3141 aren't strictly necessary for 2.6, but they will > > be needed for 3.0. I'd rather not make the two versions of Decimal > > gratuitously different, so this patc

Re: [Python-3000] [Python-Dev] Rounding Decimals

2008-01-06 Thread Raymond Hettinger
[Jeffrey Yasskin] >> > I'm not >> > sure exactly what you're objecting to. Could you be more precise? >> >> You note said: "I'll implement Context.round() in a separate patch. Comment >> away." > > Oh, sorry for not being clear then. I don't intend to write or discuss > that separate patch until

Re: [Python-3000] [Python-Dev] Rounding Decimals

2008-01-06 Thread Raymond Hettinger
[Jeffrey Yasskin] > Given Guido's agreement, expect another version of this patch with > only __trunc__. Why is __trunc__ being backported? Is a trunc() builtin being backported? What is the point for a synonym for int() and __int__ in Py2.6. Unless I'm missing something, this doesn't improve