Class Variable Access and Assignment
steve at REMOVETHIScyber.com.au
Thu Nov 3 16:59:35 CET 2005
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>?
I'm not saying that it couldn't, if that was the model for inheritance you
decided to use. I'm asking why would you want it? What is your usage case
that demonstrates that your preferred inheritance model is useful?
More information about the Python-list