HPJ wrote:
Makes sense to me. To step through what's happening:
A.n, B.n
(0, 0)
Here, the lookup on B.n fails (that is, B itself has no variable n),
and thus falls back to A.n
See, this is what tripped me up, right at the beginning. I thought B
would inherit (as in copy) the variable n from A.
Python does not copy objects unless asked to.
Inheritance is a link request, not a copy request.
Can you point out to me which part (or parts) of the Language
Reference says this is the way it's supposed to be?
I could, but I will let you read and find what it says about class
attributes.
tjr
--
http://mail.python.org/mailman/listinfo/python-list