Re: What file is foo in package bar in ?
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 -- http://mail.python.org/mailman/listinfo/python-list
What file is foo in package bar in ?
Hi - I think this is a pretty basic question but it's never worried me before. 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: thepackage.theclass.foo The problem is that 'theclass' is implemented in a file called nothingliketheclass.py so finding the implemention of foo is a bit boring. 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 ? thanks R. -- http://mail.python.org/mailman/listinfo/python-list
Re: What file is foo in package bar in ?
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 Christian -- http://mail.python.org/mailman/listinfo/python-list
Re: What file is foo in package bar in ?
On Aug 20, 11:06 am, Christian Heimes li...@cheimes.de 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 examplehttp://docs.python.org/library/inspect.html#inspect.getfile Christian That's really great thanks - just what I was after. regards R. -- http://mail.python.org/mailman/listinfo/python-list