[Python-projects] pylint/astng feature request: unreachable code in generators

Vincent Legoll vincent.legoll at gmail.com
Fri Mar 27 11:28:59 CET 2009


The attached code run through pylint reports:

W:  6:gen: Unreachable code

but the yield is necessary to have the function turned into a generator

I think this case should be handled specifically, and no Warning should be
issued, or at least it should be downgraded to "Info" or something, and then
the message changed (and the ID too) to something like:

"Unreachable yield used for the side effect of turning the method into
a generator"

But if there is other unreachable code between the raise and the yield, I think
this other code could still be flagged as unreachable, the special casing should
only be for unreachable yield statements, and maybe even only if there are only
nureachable yields in the method...

-- 
Vincent Legoll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gen.py
Type: text/x-python
Size: 211 bytes
Desc: not available
URL: <http://lists.logilab.org/pipermail/python-projects/attachments/20090327/6ea17632/attachment-0001.py>


More information about the Python-Projects mailing list