finding origin of names

Robin Becker robin at jessikat.fsnet.co.uk
Sat Jun 7 07:29:28 EDT 2003


Is it possible to determine where a particular name is defined?

As an example

#a.py
v=1

#b.py
from a import v


>>> import a, b
>>> a.v is b.v
1
>>> dir(a)
['__builtins__', '__doc__', '__file__', '__name__', 'v']
>>> dir(b)
['__builtins__', '__doc__', '__file__', '__name__', 'v']
>>>

do I have to inspect the code to determine that module a defines v? 
-- 
Robin Becker




More information about the Python-list mailing list