PEP 318

Eyal Lotem gnupeaker at
Mon Mar 22 12:04:41 CET 2004

> Good point. Though to me, it isn't that it's a pain
> for the compiler
> to search for the 'yield' - I don't care about the
> compilers pain. The
> problem is that *I* have to look for the yield and
> might not notice
> it.
You are not supposed to be looking for it, IMHO.
Generators follow the Sequence protocol and are to be
treated as sequences.  Thus, you should simply make it
clear in the
function-name/conventions/interface-documentation that
the function returns a sequence.  Whether that
sequence is implemented via a generator or not is an
implementation detail.

Do you Yahoo!?
Yahoo! Finance Tax Center - File online. File on time.

More information about the Python-list mailing list