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

Tim Peters tim.one at comcast.net
Mon May 3 22:30:30 EDT 2004


>>     # add a filter over the current pipe, and call that the new pipe
>>     pipe = (e for e in pipe if p(e))

[Delaney, Timothy C (Timothy)]
> This is a fairly convincing argument to me -

Except it's not an argument, it's just a six-month old example.  I don't
have an argument to make here.  I've observed repeatedly that in all
"reasonable" examples to date where the distinction makes a difference,
early binding does better than late binding, but I still haven't dreamt up a
"deep reason" for that.  The arguments on both sides have been singularly
uncompelling (to me, anyway).

> that is something I do all the time with listcomps.  Saves having to
> invent extra names.

I may have lost track, but I think the last plan Guido approved of here
would actually evaluate the target of the leftmost "for" ("pipe" in the
example above) immediately, leaving only "p" to get picked up later.  It's
impossible for me to guess how that might affect the things you do all the
time with listcomps; also impossible for me to guess whether you'd do
similar things with genexps.

This issue has always been long on specious arguments and short on concrete
examples.  But that's OK -- we'll get the concrete examples, but after it's
too late <wink>.





More information about the Python-Dev mailing list