[2.2b2]: class variable and classmethod, subclass

Terry Reedy tjreedy at home.com
Wed Nov 28 23:13:12 EST 2001


"{-- Rot13 - Hateme" <ungrzr2 at ubatxbat.pbz> wrote in message
news:Xns9168798CBA2B2YouAreNotMeYouKnow at 218.102.23.34...
> The problem is that a new copy of the class variable is only
> created if it is changed in the child class. If the variable
> is not mutable, that is.

> I think it is more natural that the new copies of class variables
> are created at the time of subclass definition.

I believe you can do this by including the variable in the subclass
definition instead of inheriting it from the baseclasss.

class b(a):
    value = "whatever"

I believe you can have it either way according to what you implicitly
or explicitly tell the interpreter.

Terry J. Reedy






More information about the Python-list mailing list