On Sat, 03 May 2008 03:05:31 -0700, Decebal wrote: > I have the following class: > ##### > class Dummy(): > value = 0 > def __init__(self, thisValue): > print thisValue > self.value = thisValue > value = thisValue > > def testing(self): > print 'In test: %d' % self.value > > def returnValue(self): > return self.value > > result = someFuntion(default = value) > ##### > > But the last line does not work. > I would like to do a call like: > dummy = Dummy(thisValue = 12) > > And that someFunction gets a default value of 12. How can I do that?
class Dummy(object): def __init__(self, thisValue): self.value = thisValue def someFunction(self, default=None): if default is None: default = self.value -- Ivan -- http://mail.python.org/mailman/listinfo/python-list