question about generators
greg
greg at cosc.canterbury.ac.nz
Fri Aug 16 04:24:54 EDT 2002
Tim Peters wrote:
>
> There was a lot of discussion of this at the time (dig into the iterators
> mailing list archive). We decided to keep Simple Generators, well,
> *simple*, to start with.
I don't agree with the characterisation of Python generators
as "simpler" than Icon ones (from the user's perspective).
There's a point of view from which Icon's generators are
simpler than Python's -- that is, the one Andrew Koenig
was adopting when he didn't immediately see the need for
the "for...yield" loop.
I predicted, at the time generators were introduced, that
some people would find this aspect of them unintuitive,
and it seems that I was right.
If by "simple" you're referring to the *implementation*,
then yes, it would have been much harder to add Icon-style
generators to CPython. (But only because the guts of CPython
hadn't been designed with them in mind from the beginning
like Icon had.)
Greg Ewing
More information about the Python-list
mailing list