[EMAIL PROTECTED] wrote: > Hello everybody! > I have little problem: > > class A: > def __init__(self, n): > self.data = n > def f(self, x = ????) > print x > > All I want is to make self.data the default argument for self.f(). (I > want to use 'A' class as following : > > myA = A(5) > myA.f() > > and get printed '5' as a result.) >
class A(object): # Stop using old-style classes, please def __init__(self, n): self.data = n def f(self, x = None): if x is None: x = self.data print x -- bruno desthuilliers python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for p in '[EMAIL PROTECTED]'.split('@')])" -- http://mail.python.org/mailman/listinfo/python-list