Identifying apparently unused globals

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


At work we have a fairly large application (about 20 packages, 300+ modules)
that looks like we might be heading into a bit of a plateau stage.  Now
seems like a good time to identify and delete old, unused code that's flown
under the radar screen for awhile simply because nobody was looking for it.
Trouble is, most of that unused code consists of module-level classes,
functions and variables, so it's hard to distinguish mechanically from code
that *is* used.  Is there a tool out there that will slurp in a number of
packages, identify all the global names then remove those that it determines
are referenced?  (Yes, I know it's impossible to do this in general.  We
have one very restricted exec statement and no eval() calls, so I'm not too
worried about that sort of obfuscation.)

Thx,

Skip



More information about the Python-list mailing list