Warn on "raise StopIteration"
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Pyflakes |
New
|
Undecided
|
Unassigned |
Bug Description
PEP 479 (https:/
This feature is so far only available as a __future__ import in Python 3.5.
Due to the way __future__ imports work, it's not possible to use "from __future__ import generator_stop" and support Python < 3.5 at the same time. Hence, a check on the source, i.e., pyflakes, is a good workaround (I guess there's also a deprecation warning which can be enabled, but checking code without running it is still useful).
One thing I'm still a little unclear about is if you'd ever still want to raise StopIteration legitimately, even with the new behavior. The fact that it's now a RuntimeError + a deprecation warning seems to indicate no to me, but I could be wrong.