Generators and iterators

Michael Hudson mwh at python.net
Tue Mar 5 10:10:57 EST 2002


bergeston at yahoo.fr (Bertrand Geston) writes:

> Hello,
> 
> I just quickly red the page about new features in Python 2.2 and tried - for
> fun - to test it. It must be obvious but I really don't see why, in the
> console transcript below, z.next() send back None and not 1,2 and 3
> whereas it does it correctly 3 times, no more no less.

You forgot a "return".

Cheers,
M.

-- 
39. Re graphics:  A picture is worth 10K words - but only those
    to describe the picture.  Hardly any sets of 10K words can be
    adequately described with pictures.
  -- Alan Perlis, http://www.cs.yale.edu/homes/perlis-alan/quotes.html



More information about the Python-list mailing list