PEP 255: Simple Generators

Tim Peters tim.one at home.com
Wed Jun 20 01:28:54 CEST 2001


[Nick Mathewson]
> ...
> My experience with generators comes from CLU's iterators, which also
> had a distinct syntax for declaring them.

While most of mine comes from Icon, which doesn't.  While *every* expression
in Icon "is a generator", the practical distinction between functions that
generated multiple results and those that generated exactly one remained
important -- but then so is whether a function returns an int or a list or
deletes all files matching gen*.* <wink>.  That is, I think people are
making out generators to be a bigger deal than they are here:  they're just
a very nice way to implement an iterator, and there are many other ways to
do that without using generators in 2.2.  So why aren't people agitating for
"iter" as an alternative to "def"?  Because then it would sound silly
<wink>.





More information about the Python-list mailing list