What file is foo in package bar in ?

Nitebirdz nitebirdz at sacredchaos.com
Thu Aug 20 05:46:34 EDT 2009


On Thu, Aug 20, 2009 at 01:06:00AM +0200, Christian Heimes wrote:
> northof40 wrote:
>> Given an arbitary package is there some programmatic way to 'ask' what
>> file the method/function is implemented in ?
>
> Indeed, the inspect module contains several useful functions for the  
> job, for example
> http://docs.python.org/library/inspect.html#inspect.getfile
>

Stupid question from someone who ignores it all: since the OP is reading
code from an existing tree in order to learn from it, wouldn't it make
more sense to use something like Cscope?  Assuming it works with Python,
of course.  If it doesn't, is there a similar tool that can be used?  A
related question too is whether any of these tools actually help in an
object-oriented environment.  

http://cscope.sourceforge.net/

http://www.linux.com/archive/feature/114237




More information about the Python-list mailing list