What file is foo in package bar in ?

northof40 shearichard at gmail.com
Thu Aug 20 00:55:49 CEST 2009

Hi - I think this is a pretty basic question but it's never worried me

To improve my skills I'm reading the source code of a library written
by someone else.

I've come across a problem doing that.

Commonly a function is called like this:


The problem is that 'theclass' is implemented in a file called
nothingliketheclass.py so finding the implemention of foo is a bit

Now I can grep for foo and depending on how common the method name is
that helps ... or not but I'm sure there must be a better way.

Given an arbitary package is there some programmatic way to 'ask' what
file the method/function is implemented in ?



More information about the Python-list mailing list