Skip to main content
Please don't sign your posts. http://stackoverflow.com/faq#signatures
Source Link
Matt Ball
  • 360.9k
  • 102
  • 655
  • 725

Suppose we have following code defined in tester.py

class Tester( object ):
    def method( self ):
        print 'I am a Tester'

and we have following defined in main.py

from tester import Tester
t = Tester()
#print definition of t

is there anyway we could get the definitions of a class/function from an object in a systematic way? or we have to parse the code and extract the code definition manually then save them into a string? thanks

regards, John

Suppose we have following code defined in tester.py

class Tester( object ):
    def method( self ):
        print 'I am a Tester'

and we have following defined in main.py

from tester import Tester
t = Tester()
#print definition of t

is there anyway we could get the definitions of a class/function from an object in a systematic way? or we have to parse the code and extract the code definition manually then save them into a string? thanks

regards, John

Suppose we have following code defined in tester.py

class Tester( object ):
    def method( self ):
        print 'I am a Tester'

and we have following defined in main.py

from tester import Tester
t = Tester()
#print definition of t

is there anyway we could get the definitions of a class/function from an object in a systematic way? or we have to parse the code and extract the code definition manually then save them into a string?

Source Link
John
  • 2.2k
  • 3
  • 22
  • 41

How to get the function definition from an object?

Suppose we have following code defined in tester.py

class Tester( object ):
    def method( self ):
        print 'I am a Tester'

and we have following defined in main.py

from tester import Tester
t = Tester()
#print definition of t

is there anyway we could get the definitions of a class/function from an object in a systematic way? or we have to parse the code and extract the code definition manually then save them into a string? thanks

regards, John