As an example, say I have a variable defined where there may be multiple
from __ import *
from ____ import *
etc.
Is there a way to figure out where one of the variables in the namespace is defined?
edit
Thanks, but I already understand that import * is often considered poor form. That wasn’t the question though, and in any case I didn’t write it. It’d just be nice to have a way to find where the variable came from.
This is why it is considered bad form to use
from __ import *in python in most cases. Either usefrom __ import myFuncor elseimport __ as myLib. Then when you need something frommyLibit doesn’t over lap something else.For help finding things in the current namespace, check out the pprint library, the dir builtin, the locals builtin, and the globals builtin.