Iterators & generators (RE: Real Problems with Python)
aahz at netcom.com
Tue Feb 15 13:57:02 EST 2000
In article <001e01bf7790$8bd74480$66a2143f at tim>,
Tim Peters <tim_one at email.msn.com> wrote:
>[and Aahz sez about Python's lack of "functional expression"]
>> but adding generators should make up much of the balance.
>Unsure it would help here, at least in the flavor I've been selling them.
Not directly, no, but it would extend the power of Python-style
iteration sufficiently to combat many of the complaints about the lack
of functional expression. It's essentially a completely different path
to many of the same ends, but one that fits into Python. IMO
As a side note, I'm thinking that implicit generator creation is a Bad
Idea. We should force people to do things like
b = BinTree()
g = generator b.traverse()
for i in g():
but I'm not at all certain of the syntax. Another option would be to
make "generator" a keyword on the same level as "def", so the "function
call" to a generator always creates a generator frame, and you then need
to call the generator reference (as above) for each value.
(As you've probably guessed, I strongly prefer "generator" to
"iterator", but I won't whine if you or Guido have the opposite
--- Aahz (Copyright 2000 by aahz at netcom.com)
Androgynous poly kinky vanilla queer het <*> http://www.rahul.net/aahz/
Hugs and backrubs -- I break Rule 6
Have you coined a word today?
More information about the Python-list