In <4bdb4e4...@dnews.tpgi.com.au> Lie Ryan <lie.1...@gmail.com> 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 = '.'
>...
>>>> Ham.Y; Eggs.Y
>21
>'...'


!!!hmmm!!!

That's very interesting!  I did not know about metaclasses; I need
to learn more about them.  Thanks for the pointer!

~K
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to