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 = '.'
>...
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
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