Keith Jackson wrote:

> Does anybody know of a tool that will take a module as input, look for
> any wildcard imports, and then identify what symbols in the module come
> from which wildcard import? It could then expand out the from module
> import * to from module import foo, bar. It might need to ask the user
> on this, since they might want the wildcard import for something
> special, but it would still be *much* nicer then expanding the imports
> out by hand.
> 
> Apologies ahead of time if I've missed something obvious. I did spend
> some quality time with google, and couldn't find anything.

No - and given that you could do

--- module.py ---
import random

for i in xrange(random.randint(10, 100)):
    globals()["FOO%i" % i] = "hallo"

--- module.py ---

there is not a chance of such a tool being more than a heuristic. Such
things only work in a static typed world where you know the number of
declarations.

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

Reply via email to