Comment 4 for bug 1675659

Revision history for this message
Phil Frost (bitglue) wrote :

Report seems legit to me. In the example:

import bar

class Foo:
    def bar(self):
        pass

the bar import is unused, and there should remain an error about that. But defining a bar function inside the class scope does not seem like an error. Pyflakes does not emit errors for shadowing global variables, imports or otherwise, unless it's done such that something which was imported can not possibly be used. Like this:

$ pyflakes
import foo
foo = 1
<stdin>:2: redefinition of unused 'foo' from line 1

I'm vaguely remembering there was some implementation reason for this bug, and maybe it was too difficult to fix. But that was years ago...worth at least investigating.