gry@ll.mit.edu schrieb: > Hmm, the meta-class hacks mentioned are cool, but for this simple a > case how about just: > > class A: > def __init__(self): > self.__class__.sum = self.calculate_sum() > def calculate_sum(self): > do_stuff > return sum_value
If you do it like that, Steven's second suggestion was better: class A: def calculate_sum(): do_stuff return sum_value sum = calculate_sum() That's not only easier simpler, it also avoids calling calculate_sum() every time you create an instance. -- Christoph -- http://mail.python.org/mailman/listinfo/python-list