Identifying apparently unused globals

skip at pobox.com skip at pobox.com
Tue Jul 11 13:47:02 EDT 2006


    Simon> I haven't used it myself, but pychecker
    Simon> (http://pychecker.sourceforge.net/) is supposed to be able to
    Simon> perform such stunts.  From the page: "Types of problems that can
    Simon> be found include: Unused globals and locals (module or variable)"

Thanks.  I've used both pylint and pychecker.  I'm not aware that either one
can do what I want.  Here's a trivial example:

    Module a.py:

        RED = "red"
        BLUE = "blue"

    Module b.py:

        import a
        print a.RED

Considering modules a and b as a whole program, a.BLUE is unused anywhere in
the program.

Skip



More information about the Python-list mailing list