Python or Java or maybe PHP?
aleax at mail.comcast.net
Tue Jan 3 06:06:07 CET 2006
Hans Nowak <hans at zephyrfalcon.org> wrote:
> Maybe I misunderstand, but shouldn't this be:
> def WHILE(cond):
> if not cond(): return
> yield None
> for x in WHILE(cond): yield x
> After all, the original version only yields two things: None and a
> (Or is this behavior different in Python 2.5? I hope not...)
No misunderstanding on your part, just my error on untested code -- no
changes in Python 2.5 so that yield of a generator means yielding each
of its items, my bad, sorry.
More information about the Python-list