Iterators & generators & coroutines
Aahz Maruch
aahz at netcom.com
Tue Feb 15 16:26:19 EST 2000
More information about the Python-list mailing list
Tue Feb 15 16:26:19 EST 2000
- Previous message (by thread): Iterators & generators & coroutines
- Next message (by thread): Iterators & generators & coroutines
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
In article <sajg8pv32pd171 at corp.supernews.com>, Evan Simpson <evan at 4-am.com> wrote: >Aahz Maruch <aahz at netcom.com> wrote in message >news:88c7hu$209$1 at nntp5.atl.mindspring.net... >> >> 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(): >> .... > >Why attach such significance to it? Why not just... > >b = BinTree() >for node in b.traverser(): Because now you either have the for construct implicitly create a new generator frame or you cannot do b = BinTree() for node in b.traverser(): for node in b.traverser(): I would much rather create the generator frames explicitly as in the following (I'm now assuming my later idea that a call to a generator creates a generator frame that can be used like a function) b = BinTree() g1 = b.traverser() for node in g1(): g2 = b.traverser() for node in g2(): It just seems more Pythonic to me. -- --- 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?
- Previous message (by thread): Iterators & generators & coroutines
- Next message (by thread): Iterators & generators & coroutines
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list