By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,775 Members | 1,132 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,775 IT Pros & Developers. It's quick & easy.

Re: warning for unused packages/modules/objects

P: n/a
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

Jun 28 '08 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.