[Python-Dev] PEP 289 - Generator Expressions - Let's Move Forward

Guido van Rossum guido at python.org
Fri Apr 30 19:12:59 EDT 2004


> I was using this example more generally to show that if you have a
> late-binding genexpr, you have to worry about not changing the local
> variables it uses, which looks like all uses of genexprs with free
> variables are subtle bugs waiting to appear whenever someone
> modifies the function anywhere after the genexpr.  The same argument
> applies to the other stdlib cases I mentioned (which make somewhat
> less than 10% of all uses).

That's not new, we all know that that's the downside of late binding.

My counter to that is that *any* use of genexps where the consumer
doesn't consume (or discard) the iterator before the next line is
reached is extremely advanced use.

--Guido van Rossum (home page: http://www.python.org/~guido/)



More information about the Python-Dev mailing list