Calling a generator multiple times

Courageous jkraska at san.rr.com
Fri Dec 7 02:20:42 CET 2001


>Er... where is this "f" going to be stored?

After I posted my message, it occured to me that I wasn't
addressing a key part of the semantics, namely the ability
for multiple consumers to generate the generator multiple
times. While I understand that part of the problem is
critical, if you don't mind, I'll politely dodge it*. The
fact remains, as you state that you understand below, the
current implementation of generators is counter-intuitive,
misleading, and incongruous with Python itself.

>When generators first appeared, quite a number of
>people, including me, argued fervently and passionately
>that generators *shouldn't* look like ordinary functions,
>for this very reason.

I agree with you emphatically, and while I am sure that this
comment is a bit snide, let's just say that "language
designer's intuition" should probably needs to smell out
how an average newbie pythonista would react to a function
that isn't.

C//




More information about the Python-list mailing list