>>> class StealthMeta(type):
... def __new__(cls, name, bases, attrs):
... del attrs['__metaclass__']
... return type.__new__(cls, name, bases, attrs)
...
>>> class A(object):
... __metaclass__ = StealthMeta
...
>>> A.__metaclass__
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: type object 'A' has no attribute '__metaclass__'
>>> isinstance(A, StealthMeta)
True
No comments:
Post a Comment