Here is a full program.
""" List classes, methods, functions and function/method args
in a module
Created: Anand B Pillai
"""
from types import *
import inspect
def analyze_func(obj, method=False):
if method:
print 'Method: %s' % obj.__name__
else:
print 'Function: %s'
In addition to all the nice tips provided earlier... my 0.2cents !
If your module has doc strings then you can use something like:
~
import os
help(os)
~
--
seShadri
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Pradeep Kisho
Heshan,
You will find http://docs.python.org/lib/inspect-types.html helpful.
"A.__dict__["foo"].func_code.co_varnames" will give you arguments of foo.
CP
On 3/13/08, Heshan Suriyaarachchi <[EMAIL PROTECTED]> wrote:
>
> Hi
>I am talking about a scenario like this
>
> class A:
> def foo(v
Ah! i forgot about the function parameter list.. Will look into it.
+Pradeep
On 3/13/08, Pradeep Kishore Gowda <[EMAIL PROTECTED]> wrote:
> On 3/13/08, Heshan Suriyaarachchi <[EMAIL PROTECTED]> wrote:
> > Hi
>
> >I am talking about a scenario like this
> >
> > class A:
> > def foo(var
On 3/13/08, Heshan Suriyaarachchi <[EMAIL PROTECTED]> wrote:
> Hi
>I am talking about a scenario like this
>
> class A:
> def foo(var1,var2):
> return 'Hello'
> def echo():
> return 'testing'
>
>
> class B:
> def bar(car):
> val = car
> return car
>
Hi
I am talking about a scenario like this
class A:
def foo(var1,var2):
return 'Hello'
def echo():
return 'testing'
class B:
def bar(car):
val = car
return car
What I need is to find out the classes and the methods of each class with
their paramete