Determining which things in 'from package import *' are actually used

P

Patrick Bouffard

I have a fairly large library of Python code, where 'from package import *' is
used rather liberally, and it's not uncommon for more than one of these to
appear in any given module. What I'd like to be able to do is to clean my code
up a bit and turn each of the 'from package import *' statements into 'from
package import thing_1, thing_2, ..., thing_n', where only thing_i's that are
actually _used_ in the module are imported. In this way I hope to make my code a
bit more understandable by future civilizations. :) (it needs all the help it
can get!)

Does anyone know of a package/recipe/whatever that does something like this
automatically, even in limited cases? Ideally it should be accomplished only by
looking at the source, or at most, importing the module.

TIA,

-Pat
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,015
Latest member
AmbrosePal

Latest Threads

Top