On Fri, 04 Nov 2005 09:24:41 -0500, Christopher Subich <[EMAIL PROTECTED]> wrote:
>Steven D'Aprano wrote: >> On Thu, 03 Nov 2005 14:13:13 +0000, Antoon Pardon wrote: >> >> >>>Fine, we have the code: >>> >>> b.a += 2 >>> >>>We found the class variable, because there is no instance variable, >>>then why is the class variable not incremented by two now? >> >> >> Because b.a += 2 expands to b.a = b.a + 2. Why would you want b.a = >> <something> to correspond to b.__class__.a = <something>? > >Small correction, it expands to b.a = B.a.__class__.__iadd__(b.a,2), >assuming all relevant quantities are defined. For integers, you're >perfectly right. But before you get to that, a (possibly inherited) type(b).a better not have a __get__ method trumping __class__ and the rest ;-) Regards, Bengt Richter -- http://mail.python.org/mailman/listinfo/python-list