----- Mensaje original ----
> De: Gerald Britton <gerald.brit...@gmail.com>
> Para: Terry Reedy <tjre...@udel.edu>
> CC: python-dev@python.org
> Enviado: lunes, 19 de enero, 2009 15:03:47
> Asunto: Re: [Python-Dev] PEP 3142: Add a "while" clause to generator
> expressions
>
> Duly noted and thanks for the feedback! (just what I was looking for
> actually). I do disagree with the idea that the proposal, if
> implemented, would make Python harder to learn. Not sure who would
> find it harder. Having to find and use takewhile was harder for me.
> I still find that one counter-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.
Are you even sure the list comprehension doesn't already shortcut evaluation?
This quick test in 2.6 hints otherwise:
>>> a = (i for i in range(10) if i**2<10)
>>> a.next()
0
>>> a.next()
1
>>> a.next()
2
>>> a.next()
3
>>> a.next()
Traceback (most recent call last):
File "<pyshell#32>", line 1, in <module>
a.next()
StopIteration
¡Todo sobre la Liga Mexicana de fútbol! Estadisticas, resultados,
calendario, fotos y más:<
http://espanol.sports.yahoo.com/
_______________________________________________
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/archive%40mail-archive.com