Daniel Fetchinson wrote:
How difficult would it be to implement a system in python that would
warn if there are unnecessarily imported packages/modules/objects in
the code? I mean that when developing some code one frequently imports
stuff, deletes the import, changes stuff here and there, imports other
stuff, later decides to change things and consequently delete the line
with the import, etc, etc. As a result there can stay
packages/modules/objects that are in the end not used. It would be
great if python would issue a warning once the program finishes.

Style-checkers will help with this. pylint, pychecker, and pyflakes are all good tools. I tend to use pyflakes most often. It's small and doesn't do as much as the others, but it does unused imports and undefined name checks much faster than the others. I can run it compulsively on my file.

--
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth."
  -- Umberto Eco

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to