On Mon, Nov 17, 2014 at 11:05:01AM +1300, Greg Ewing wrote:
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.
I don't see how that is different from any other __future__ directive. They are all per-module, and if you gain access to an object from another module, it will behave as specified in the module that created it, not the module that imported it. How is this different?