On 2007-12-06, samwyse <[EMAIL PROTECTED]> wrote: > On Dec 6, 1:12 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > And that's my complaint. The value in <zed> is being replaced by > something almost, but not quite, identical to the original value. > Python's internal implementation of __iadd__ for <int> isn't returning ><self>, it's returning a new value belonging to the super-class. My > whole point is overloading <int> was that I'd hoped to avoid having to > write a bunch of methods to perform in-place modifications. Looks > like I stuck, however.
I think you don't want this. Suppose I keep track of addition information (eg a boolean "is_even = value == value//2") Since the base class doesn't know about this, it may return an incorrect instance. Albert -- http://mail.python.org/mailman/listinfo/python-list