Re: Inheritable computed class attributes?

2010-04-30 Thread kj
In <4bdb4e4...@dnews.tpgi.com.au> Lie Ryan writes: >class MetaSpam(type): >@property >def Y(cls): >return cls.X * 3 >class Spam(object): >__metaclass__ = MetaSpam >and there we go: class Ham(Spam): >... X = 7 >... class Eggs(Spam): >... X = '.' >...

Re: Inheritable computed class attributes?

2010-04-30 Thread Lie Ryan
On 05/01/10 06:42, kj wrote: > I want to define a class attribute that is computed from other > class attributes. Furthermore, this attribute should be inheritable, > and its value in the subclasses should reflect the subclasses values > of the attributes used to compute the computed attribute. I

Inheritable computed class attributes?

2010-04-30 Thread kj
I want to define a class attribute that is computed from other class attributes. Furthermore, this attribute should be inheritable, and its value in the subclasses should reflect the subclasses values of the attributes used to compute the computed attribute. I tried the following: class Spam(o