Python or Java or maybe PHP?

Alex Martelli aleax at
Tue Jan 3 00:06:07 EST 2006

Hans Nowak <hans at> 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 
> generator.
> (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 mailing list