[Python-ideas] PEP 479: Change StopIteration handling inside generators

Greg Ewing greg.ewing at canterbury.ac.nz
Sun Nov 16 23:05:01 CET 2014


Chris Angelico wrote:
> if you call on someone else's generator,
> and that someone hasn't applied the __future__ directive, you'll be in
> the current situation of not being able to distinguish 'return' from
> 'raise StopIteration'. But for your own generators, you can guarantee
> that they're distinct.

This suggests that the use of a __future__ directive is not
really appropriate, since it can affect code outside of the
module with the __future__ directive in it.

-- 
Greg


More information about the Python-ideas mailing list