Re: [Python-Dev] Rationale for sum()'s design?

2005-03-13 Thread Alex Martelli
On Mar 14, 2005, at 01:22, Greg Ewing wrote: Guido van Rossum wrote: - the identity (defaulting to 0) if the sequence is empty - the first and only element if the sequence only has one element - (...(((A + B) + C) + D) + ...) if the sequence has more than one element While this might be reasonable

Re: [Python-Dev] Rationale for sum()'s design?

2005-03-13 Thread Michael Walter
That is like Lisp's +, must be good :P Michael On Sun, 13 Mar 2005 08:38:42 -0800, Guido van Rossum <[EMAIL PROTECTED]> wrote: > There are a few design choices we could have made for sum(); in > particular, for non-empty sequences we could not have used the > identity element (the optional secon

Re: [Python-Dev] RELEASED Python 2.4.1, release candidate 1

2005-03-13 Thread Kurt B. Kaiser
"Martin v. Löwis" <[EMAIL PROTECTED]> writes: >> I downloaded the 2.4.1c1 installer to the desktop and clicked on it. >> It complained that it couldn't access the installer. > > Do you happen to remember the precise error message? "This installation package could not be opened." > >> I then clic

Re: [Python-Dev] Rationale for sum()'s design?

2005-03-13 Thread Guido van Rossum
[Guido van Rossum] > > > > - the identity (defaulting to 0) if the sequence is empty > > - the first and only element if the sequence only has one element > > - (...(((A + B) + C) + D) + ...) if the sequence has more than one element [Greg Ewing] > While this might be reasonable if the identity >

RE: [Python-Dev] comprehension abbreviation (was: Adding any() andall())

2005-03-13 Thread Raymond Hettinger
[GvR] > > - Before anybody asks, I really do think the reason this is requested > > at all is really just to save typing; there isn't the "avoid double > > evaluation" argument that helped acceptance for assignment operators > > (+= etc.), and I find redability is actually improved with 'for'. {Ne

Re: [Python-Dev] code blocks using 'for' loops and generators

2005-03-13 Thread Greg Ewing
Brian Sabbey wrote: How about something like below? In the same way that "self" is passed "behind the scenes" as the first argument, so can the thunk be. with stopwatch() result dt: a() b() print 'it took', dt, 'seconds to compute' Something like that would be better, yes. Maybe even ju

Re: [Python-Dev] Rationale for sum()'s design?

2005-03-13 Thread Greg Ewing
Guido van Rossum wrote: - the identity (defaulting to 0) if the sequence is empty - the first and only element if the sequence only has one element - (...(((A + B) + C) + D) + ...) if the sequence has more than one element While this might be reasonable if the identity argument is not specified, I

Re: [Python-Dev] comprehension abbreviation (was: Adding any() and all())

2005-03-13 Thread Neil Hodgson
Guido van Rossum: > - Before anybody asks, I really do think the reason this is requested > at all is really just to save typing; there isn't the "avoid double > evaluation" argument that helped acceptance for assignment operators > (+= etc.), and I find redability is actually improved with 'for'.

Re: [Python-Dev] code blocks using 'for' loops and generators

2005-03-13 Thread Brian Sabbey
On Mon, 14 Mar 2005, Greg Ewing wrote: Brian Sabbey wrote: The problem with creating a new mechanism is that sometimes you will want to loop. For example, reading a bunch of items from a shared resource, modifying them, and sending them back. A new, non-looping mechanism will not be adequate f

Re: [Python-Dev] code blocks using 'for' loops and generators

2005-03-13 Thread Greg Ewing
Brian Sabbey wrote: The problem with creating a new mechanism is that sometimes you will want to loop. For example, reading a bunch of items from a shared resource, modifying them, and sending them back. A new, non-looping mechanism will not be adequate for this because it cannot loop, If ther

Re: [Python-Dev] Adding any() and all()

2005-03-13 Thread Eric Nieuwland
I think the discussion should separate numeric calculation and truth value calculation. Numeric calculation need to run through all elements, with the order possibly important. Truth value calculation (as per any() and all()) may terminate before all elements have been seen. Finally, any(), all(

Re: [Python-Dev] Open issues for 2.4.1

2005-03-13 Thread Martin v. Löwis
Anthony Baxter wrote: Ok, I'm convinced - Martin, can you check this in? Done! Martin ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/arch

Re: [Python-Dev] code blocks using 'for' loops and generators

2005-03-13 Thread Brian Sabbey
On Sun, 13 Mar 2005, Greg Ewing wrote: Brian Sabbey wrote: I prefer re-using the 'for' loop for this purpose because it allows the problem to be solved in a general way by re-using a structure with which most users are already familiar, and uses generators, which are easier to use in this case t

[Python-Dev] Rationale for sum()'s design?

2005-03-13 Thread Guido van Rossum
There are a few design choices we could have made for sum(); in particular, for non-empty sequences we could not have used the identity element (the optional second argument). As it is, we get unjustified but understandable complaints that sum() "only supports numbers". An alternative design could

Re: [Python-Dev] comprehension abbreviation (was: Adding any() and all())

2005-03-13 Thread Guido van Rossum
[Nick Coghlan] > > That 'x in seq' bit still shouts "containment" to me rather than > > iteration, though. > > > > Perhaps repurposing 'from': > > > > (x from seq if f(x)) > > > > That rather breaks TOOWTDI though (since it is essentially new syntax > > for a for loop). And I have other hopes for

new-style sxceptions (was Re: [Python-Dev] Open issues for 2.4.1)

2005-03-13 Thread Michael Hudson
Robey Pointer <[EMAIL PROTECTED]> writes: > (I've been lurking for a while but this is my first post. I maintain > paramiko and enjoy harrassing people on sourceforge to fix the > new-style Exception bug that vexes me. Nice to meet you all.) :) Well, hey, you can review my patch if you like:

Re: [Python-Dev] Python2.4.1c1 and win32com

2005-03-13 Thread Martin v. Löwis
Leeuw van der, Tim wrote: I agree that this needs to be investigated, b/c valid code shouldn't result in a syntax error. But just to make sure there's no misunderstandings: Python2.4.1rc1 fixed the crashes. And the generated file is 1.5Mb big; I think I should not post it as - is but rather compres

RE: [Python-Dev] Python2.4.1c1 and win32com

2005-03-13 Thread Leeuw van der, Tim
-Original Message- From: "Martin v. Lowis" [mailto:[EMAIL PROTECTED] Sent: Saturday, March 12, 2005 3:12 PM To: Leeuw van der, Tim Cc: python-dev@python.org Subject: Re: [Python-Dev] Python2.4.1c1 and win32com > Leeuw van der, Tim wrote: > > The generated files crash the Python interpre

RE: [Python-Dev] RELEASED Python 2.4.1, release candidate 1

2005-03-13 Thread Vincent Wehren
Martin, This is somewhat of a corner case, but maybe worth investigating: To check what I mentioned on comp.lang.python earlier, I ran the installer again (with 2.4.1 still intact), selected the "Change Python 2.4.1c1" radio button, clicked the "Finish" Button, clicked the "Advanced" button, clic

Re: [Python-Dev] RELEASED Python 2.4.1, release candidate 1

2005-03-13 Thread Martin v. Löwis
Kurt B. Kaiser wrote: I had some strange experiences. Weird indeed. I downloaded the 2.4.1c1 installer to the desktop and clicked on it. It complained that it couldn't access the installer. Do you happen to remember the precise error message? I then clicked on the 2.4.1b2 installer and that started

Re: [Python-Dev] Open issues for 2.4.1

2005-03-13 Thread Anthony Baxter
On Sunday 13 March 2005 18:35, Robey Pointer wrote: > [on the os.access unicode fix] Ok, I'm convinced - Martin, can you check this in? -- Anthony Baxter <[EMAIL PROTECTED]> It's never too late to have a happy childhood. ___ Python-Dev mailing li