On Tue, 08 Sep 2009 04:36:19 -0700, 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.
Inherit does not mean copy. What makes you think it does? Given the following: class A(object): def foo(self): return "foo" class B(A): pass would you expect the B class to have a copy of the foo method? -- Steven -- http://mail.python.org/mailman/listinfo/python-list