Python Language Using a metaclass


Example

Metaclass syntax

Python 2.x2.7
class MyClass(object):
    __metaclass__ = SomeMetaclass
Python 3.x3.0
class MyClass(metaclass=SomeMetaclass):
    pass

Python 2 and 3 compatibility with six

import six

class MyClass(six.with_metaclass(SomeMetaclass)):
    pass