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
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
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
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