PEP 318
Paul Rubin
http
Mon Mar 22 07:40:48 EST 2004
Eyal Lotem <gnupeaker at yahoo.com> writes:
> 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.
But that's bogus. Python is dynamically typed which means that a
normal function can return whatever it wants, sequence or
non-sequence. A generator function can't return anything, it can only
yield.
More information about the Python-list
mailing list