blob: 5cc63203b0ce1486457dedd1b1c31e7a4bc542e7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
#<ex.py>
class B(object):
def __init__(self, *args):
print "B.__init__"
super(B, self).__init__(*args)
class M(B, type):
def __init__(self, n, b, d):
print "M.__init__"
super(M, self).__init__(n, b, d)
class C(B):
__metaclass__ = M
def __init__(self):
print "C.__init__"
super(C, self).__init__()
#</ex.py>
>>> from ex import C
M.__init__
B.__init__
>>> c = C()
C.__init__
B.__init__
|