using function list to search function definition in another

This is the place for queries that don't fit in any of the other categories.

using function list to search function definition in another

Postby the mechanist » Wed Jul 24, 2013 4:45 am

Hi,

I am working on scripts which use python as the language and I feel it difficult to retrieve/look into the definition of a function which is written in some other file and at some other location.

I used Function list and it works fine for a single file(that is I can see all the function whose definition are in one file). Is it possible to extend the function list capability to help us find the function definition across all the files present in a location.
the mechanist
 
Posts: 1
Joined: Wed Jul 24, 2013 4:37 am

Re: using function list to search function definition in ano

Postby micseydel » Wed Jul 24, 2013 5:08 am

Could you please give examples for what you're talking about? Also, you should look up the words you're using, because I know Python well but have no idea what you're trying to say,
the mechanist wrote:Is it possible to extend the function list capability
Join the #python-forum IRC channel on irc.freenode.net!
User avatar
micseydel
 
Posts: 929
Joined: Tue Feb 12, 2013 2:18 am
Location: Mountain View, CA

Re: using function list to search function definition in ano

Postby Yoriz » Wed Jul 24, 2013 5:52 am

Do you mean help or dir
New Users, Read This
Join the #python-forum IRC channel on irc.freenode.net!
Spam topic disapproval technician
Windows7, Python 2.7.4., WxPython 2.9.5.0., some Python 3.3
User avatar
Yoriz
 
Posts: 565
Joined: Fri Feb 08, 2013 1:35 am
Location: UK

Re: using function list to search function definition in ano

Postby ochichinyezaboombwa » Wed Jul 24, 2013 6:26 pm

Something like this? --
Code: Select all
>>> import os, glob
>>> mod_list = [os.path.splitext(x)[0] for x in glob.glob("*.py")]
>>> for mod_name in mod_list:
...     mod = __import__(mod_name)
...     print mod_name, [nm for nm in dir(mod) if type(getattr(mod, nm)) == type(lambda x : x)]
...
ochichinyezaboombwa
 
Posts: 200
Joined: Tue Jun 04, 2013 7:53 pm


Return to General Coding Help

Who is online

Users browsing this forum: No registered users and 2 guests