Guido van Rossum wrote:
> This has usually been solved by creating a non-meta class whose only
> purpose is to introduce the new metaclass. You'd write
>
> class TheLarch(KindsOfTrees, deciduous): ...
>
> and the metaclass would be called KindsOfTreesMeta.
I think many people find this ugly. I have a little helper function
that
I use to make things a little clearer (at least in my eyes). Of course,
these things are always in the eye of the beholder (as evidenced by the
original message).
def of_type(metaclass):
class MetaclassMixin(object):
__metaclass__ = metaclass
return MetaclassMixin
... and then I simply use this on my classes when I define them:
class MyClass(of_type(SomeMetaclass)):
...
I find this to be fairly useful, and simple.
--
Jonathan LaCour
http://cleverdevil.org
_______________________________________________
Python-3000 mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe:
http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com