How to display all the methods supported by an instance using dir( )..please hel
Learn Python
learnpython at hotmail.com
Fri Jun 22 02:32:40 EDT 2001
hi all,
i'm a begginer in python,
This is what i have:
class test:
def __init__(self):
self.data = 100
def func(self):
pass
if __name__ == '__main__':
t = test()
dir(t) ==> i want this to list data and func
But it does'nt list func :-(. What methods s'd i provide in addition so that
dir( ) can recognize func() which happens to be a instance method attribute?
I guess this s'd be possible bcos when i say
l = [] and then dir(l), i get all the list attributes. I want the same kind
of behaviour for my class instance as well.
thanks in advance
karthik.
_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
More information about the Python-list
mailing list