Re: [Tutor] Listing all of an instances variables

2005-10-10 Thread Kent Johnson
Matt Williams wrote: Dear List, I'm stuck on trying to write a generic 'report' function: Class SomeClass: def __init__(self,a,b): self.a = a self.b = b def report(self): for i in dir(self): print self.i Error Traceback.. This is where I

[Tutor] Listing all of an instances variables

2005-10-08 Thread Python
def report(self): for i in dir(self): # use the getattr function print getattr(self, i) -- Lloyd Kvam Venix Corp ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor