[Python-ideas] x=(yield from) confusion [was:Yet another alternative name for yield-from]

Nick Coghlan ncoghlan at gmail.com
Mon Apr 6 23:40:17 CEST 2009


Jacob Holm wrote:
> If you insist it is
> an error to return a value as response to GeneratorExit, raise
> RuntimeError. But *please* don't just swallow the value.

As I asked in the other thread (but buried in a longer message): why do
you see it as OK for close() to throw away every later value a generator
may have yielded, but not OK for it to throw away the return value?

close() is for finalisation so that generators can have a __del__ method
and hence we can allow yield inside try-finally. That's it. Don't break
that by trying to turn close() into something it isn't.

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia
---------------------------------------------------------------



More information about the Python-ideas mailing list