[Python-ideas] Making it easy to prepare for PEP479

Ram Rachum ram at rachum.com
Mon May 18 10:14:31 CEST 2015

Hi everybody,

I just heard about PEP479, and I want to prepare my open-source projects
for it.

I have no problem changing the code so it won't depend on StopIteration to
stop generators, but I'd also like to test it in my test suite. In Python
3.5 I could use `from __future__ import generator_stop` so the test would
be real (i.e. would fail wherever I rely on StopIteration to stop a
generator). But I can't really put this snippet in my code because then it
would fail on all Python versions below 3.5.

This makes me think of two ideas:

1. Maybe we should allow `from __future__ import whatever` in code, even if
`whatever` wasn't invented yet, and simply make it a no-op? This wouldn't
help now but it could prevent these problems in the future.
2. Maybe introduce a way to do `from __future__ import generator_stop`
without including it in code? Maybe a flag to the `python` command? (If
something like this exists please let me know.)

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20150518/a3eb1386/attachment.html>

More information about the Python-ideas mailing list