[Tutor] trouble displaying instance attributes and methods

Learn Python learnpython@hotmail.com
Fri, 22 Jun 2001 08:08:37 -0000


hi all,

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
karthik.
_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.