Inheriting property functions

Bruno Desthuilliers bdesth.quelquechose at
Sat Oct 21 23:52:28 CEST 2006

mdsteele at a écrit :
> The trouble is that get_a and set_a are attributes of the _class
> object_ A.  Instances of A (and hence, instances of B) will see them,
> but the class B will not,

Yes it does:

 >>> class A(object):
...     aa = "aa"
 >>> class B(A):pass
 >>> B.aa

> so you have to point to them explicitly with
> A.get_a and A.set_a.

Actually, while the solution is good, the explanation is wrong.

More information about the Python-list mailing list