finding origin of names

Andreas Jung lists at andreas-jung.com
Sat Jun 7 07:59:33 EDT 2003


What is the usecase for this? It looks to me that you should verify your
data-model...I have never been in a situation during my 10 year Python 
experience
where I have to check this.

-aj

--On Samstag, 7. Juni 2003 12:29 Uhr +0100 Robin Becker 
<robin at jessikat.fsnet.co.uk> wrote:

> 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
> --
> http://mail.python.org/mailman/listinfo/python-list









More information about the Python-list mailing list