Created
March 16, 2014 14:25
-
-
Save kjelly/9584023 to your computer and use it in GitHub Desktop.
Python multi-inheritance , __init__ 。正常的 code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class A(object): | |
def __init__(self, parent=None): | |
super(A, self).__init__() | |
print 'init A class' | |
class B(object): | |
def __init__(self, parent=None): | |
super(B, self).__init__() | |
print 'init B class' | |
class C(A, B): | |
def __init__(self, parent=None): | |
super(self.__class__, self).__init__(parent) | |
print 'init C class' | |
c = C() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
compre to this
-- coding: UTF8 --
class A(object):
def init(self, parent=None):
print 'init A class'
class B(object):
def init(self, parent=None):
print 'init B class'
class C(A, B):
def init(self, parent=None):
super(self.class, self).init(parent)
print 'init C class'
c = C()