"Xavier Décoret" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] >> class A( object): >> def __init__(self, value): >> self.value = value
>More seriously, try to do this with your simpler approach. >a = A(4) >b = A(lambda : a.x+5) >a.x = 2 >print b.x # I want this to be 7, not 9 As written, it will be neither, since b.x is a function. But if you call it, its value *is* 7, not 9, as you specified wanting. So I don't understand your point. >>> class A: ... def __init__(self,val): self.x = val ... >>> a = A(4) >>> b = A(lambda : a.x+5) >>> a.x=2 >>> b.x <function <lambda> at 0x008D1650> >>> b.x() 7 Terry J. Reedy
-- http://mail.python.org/mailman/listinfo/python-list