#!/usr/bin/python
from six import with_metaclass
class A(type):
def TestA(self):
print('TestA')
class B(object):
def TestB(self):
print('TestB')
class C(with_metaclass(A,B)):
def TestC(self):
print('TestC')
c=C()
c.TestC()
c.TestB()
c.TestA()
输出结果:
TestC
TestB
Traceback (most recent call last):
File "/tmp/516425337/main.py", line 20, in <module>
c.TestA()
AttributeError: 'C' object has no attribute 'TestA'
exit status 1