On 10/14/10 20:48, Steven D'Aprano wrote:
(3) Generators with side-effects. I know, I know, if you write functions
with side-effects, you're in a state of sin already, but there's no need
for Python to make it worse.
(4) Expensive generators. The beauty of generators is that they produce
values on demand. Making all generators cache their first value means
that you pay that cost even if you end up never needing the first value.
I'd consider "expensive generators" a subset (or at least
intersecting) "generators with side-effects"...that side-effect
being time-consumed. Either way, I'm pretty firmly with you in
the "don't do it by default; let me explicitly wrap it if I want
it" camp.
-tkc
--
http://mail.python.org/mailman/listinfo/python-list