Re: [Python-Dev] PEP 3142: Add a "while" clause to generator expressions

2009-01-21 Thread Gerald Britton
ould cover itertools.takewhile but not itertools.dropwhile, AFAICS On Wed, Jan 21, 2009 at 10:27 AM, Vitor Bosshard wrote: > - Mensaje original >> De: Gerald Britton >> Para: rdmur...@bitdance.com >> CC: python-dev@python.org >> Enviado: miƩrcoles, 21 de enero, 200

Re: [Python-Dev] PEP 3142: Add a "while" clause to generator expressions

2009-01-21 Thread Gerald Britton
FWIW, there are a few historic languages that implement a compound for-loop: Algol 68, PL/I, SAS et al allow constructs that, if translated to an equivalent (currently invalid) Python-style syntax would look like this" for in while : Some also allow for an "until" keyword. I'm not suggest

Re: [Python-Dev] PEP 3142: Add a "while" clause to generator expressions

2009-01-20 Thread Gerald Britton
I wonder if this is a bug? On Tue, Jan 20, 2009 at 11:32 AM, Vitor Bosshard wrote: > - Mensaje original >> De: "python-3...@udmvt.ru" >> Para: Gerald Britton >> CC: python-dev@python.org >> Enviado: martes, 20 de enero, 2009 11:18:24 >> Asun

Re: [Python-Dev] PEP 3142: Add a "while" clause to generator expressions

2009-01-20 Thread Gerald Britton
Right, but the PEP is only about generator expressions. On Tue, Jan 20, 2009 at 11:32 AM, Vitor Bosshard wrote: > - Mensaje original >> De: "python-3...@udmvt.ru" >> Para: Gerald Britton >> CC: python-dev@python.org >> Enviado: martes, 20 de enero,

Re: [Python-Dev] PEP 3142: Add a "while" clause to generator expressions

2009-01-20 Thread Gerald Britton
, Alexey G. Shpagin wrote: > On Tue, Jan 20, 2009 at 10:45:27AM -0500, Gerald Britton wrote: >> OK, so your suggestion: >> >> g = (n for n in range(100) if n*n < 50 or raiseStopIteration()) >> >> really means "return in in the range 0-99 if n-s

Re: [Python-Dev] PEP 3142: Add a "while" clause to generator expressions

2009-01-20 Thread Gerald Britton
instead like the first time around, StopIteration will be raised and (presumably) the generator will terminate. On Tue, Jan 20, 2009 at 10:38 AM, Alexey G. Shpagin wrote: > On Tue, Jan 20, 2009 at 09:24:32AM -0500, Gerald Britton wrote: >> hmmm...doesn't: >> >> if n*n

Re: [Python-Dev] PEP 3142: Add a "while" clause to generator expressions

2009-01-20 Thread Gerald Britton
, wrote: > On Mon, Jan 19, 2009 at 10:10:00AM -0500, Gerald Britton wrote: >> Please find below PEP 3142: Add a "while" clause to generator >> expressions. I'm looking for feedback and discussion. >> > ... >> g = (n for n in range(100) while n

Re: [Python-Dev] PEP 3142: Add a "while" clause to generator expressions

2009-01-19 Thread Gerald Britton
-intuitive. I would have expected the parameters in the reverse order (take something, while something else is true). Tripped me up a few times, which got me thinking about an alternative. On Mon, Jan 19, 2009 at 12:51 PM, Terry Reedy wrote: > Gerald Britton wrote: >> >> Please

Re: [Python-Dev] PEP 3142: Add a "while" clause to generator expressions

2009-01-19 Thread Gerald Britton
. So, actually the takewhile version is two characters longer, not counting "import itertools" of course! On Mon, Jan 19, 2009 at 11:44 AM, Daniel Stutzbach wrote: > On Mon, Jan 19, 2009 at 10:37 AM, Gerald Britton > wrote: >> >>prime = (p for p in sieve()

Re: [Python-Dev] PEP 3142: Add a "while" clause to generator expressions

2009-01-19 Thread Gerald Britton
ntax would find > so many more uses of the construct to be worth it? I believe not. > > On Mon, Jan 19, 2009 at 10:10 AM, Gerald Britton > wrote: >> Please find below PEP 3142: Add a "while" clause to generator >> expressions. I'm looking for feedback and discu

Re: [Python-Dev] PEP 3142: Add a "while" clause to generator expressions

2009-01-19 Thread Gerald Britton
ile(lamda p:p<1000, sieve()) to get the primes under 1000. On Mon, Jan 19, 2009 at 11:15 AM, Daniel Stutzbach wrote: > On Mon, Jan 19, 2009 at 9:10 AM, Gerald Britton > wrote: >> >> g = (n for n in range(100) if n*n < 50) >> >> would yield 0, 1, 2, 3,

[Python-Dev] PEP 3142: Add a "while" clause to generator expressions

2009-01-19 Thread Gerald Britton
d-text indent-tabs-mode: nil sentence-end-double-space: t fill-column: 70 coding: utf-8 End: PEP: 3142 Title: Add a "while" clause to generator expressions Version: $Revision: 68715 $ Last-Modified: $Date: 2009-01-18 11:28:20 +0100 (So, 18. Jan 2009) $ Author: Gerald Britton Status: