On Thu, Mar 26, 2009 at 4:19 PM, P.J. Eby wrote: >> What I don't like is the confusion of adding "return values" to generators, >> at least using the 'return' statement.
At Fri Mar 27 04:39:48 CET 2009, Guido van Rossum replied: > I'm +1 on "yield from" and +0 on return values in generators. > def g(): > yield 42 > return 43 > for x in g(): > print x # probably expected to print 42 and then 43 I still don't see why it needs to be a return statement. Why not make the intent of g explicit, by writing either def g(): yield 42 yield 43 or def g(): yield 42 raise StopIteration(43) -jJ _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com