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

Armin Rigo arigo at tunes.org
Sat May 1 03:08:48 EDT 2004


Hello Guido,

On Fri, Apr 30, 2004 at 04:12:59PM -0700, Guido van Rossum wrote:
> 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.

My argument was that late-binding make it even more mysterious, not less
suprizing, because in the minority of cases where a listcomp is not used
immediately but still need a genexpr for performance, you have to think
carefully.

Well, I insist a bit because I cannot helping thinking that the arguments for
early-binding are "that's useful in a very small number of cases", and the
arguments for late-binding are "you don't want to do that anyway so let's pick
the semantic of free vars in functions".  I don't immediately think of genexps
as similar to functions, rather closer to listcomps, even if I know that they
are functions under the hood.


Armin




More information about the Python-Dev mailing list