PEP 255: Simple Generators
Michael Hudson
mwh at python.net
Thu Jun 21 18:19:40 EDT 2001
"Tim Peters" <tim at digicool.com> writes:
> [Terry Reedy]
> > When I first read the PEP, I assumed that def'ed generators would
> > somehowreturn the successive yielded values on successive calls (wrong).
>
> Alas, I believe that. For good or ill, PEPs aren't tutorials, they're aimed
> much more at developers of Python (as distinguished from developers using
> Python). A good user's intro to Python generators doesn't exist yet
> (AFAIK).
And writing one's going to be tricky, 'cause a generator is only a big
win when there's lots of state that has to be maintained across yields
and such an example is necessarily hairy. Same deal for weak refs -
a simple example is necessarily contrived.
oh-well-ly y'rs
M.
--
SCSI is not magic. There are fundamental technical reasons why it
is necessary to sacrifice a young goat to your SCSI chain now and
then. -- John Woods
More information about the Python-list
mailing list