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 > > > > > This is where I run

[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

Re: [Tutor] Listing all of an instances variables

2005-10-08 Thread Karl Pflästerer
On 8 Okt 2005, [EMAIL PROTECTED] wrote: > Class SomeClass: >def __init__(self,a,b): > self.a = a > self.b = b > >def report(self): > for i in dir(self): > print self.i > > > > > This is where I run into problems: How do I return all of the variables > in an in

[Tutor] Listing all of an instances variables

2005-10-08 Thread Matt Williams
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 This is where I run into problems: How do I return all of the varia