codepad
[
create a new paste
]
login
|
about
Language:
C
C++
D
Haskell
Lua
OCaml
PHP
Perl
Plain Text
Python
Ruby
Scheme
Tcl
# -*- coding: utf-8 -*- class A(object): def __init__(self, arg1): print "init func in A, with arg1 '%s'" % arg1 class B(object): def __init__(self, arg1, arg2): print "init func in B, with arg1'%s', arg2 '%s'" % (arg1, arg2) class C(A, B): def __init__(self, arg1, arg2): print "init func in C, with arg1'%s', arg2 '%s'" % (arg1, arg2) super(C, self).__init__(arg1) #这两行 #A.__init__(self, arg1) #等价 B.__init__(self, arg1, arg2) print C.__mro__ c = C("C's arg1", "C's arg2")
Private
[
?
]
Run code
Submit