Created
March 5, 2012 13:27
-
-
Save raimon49/1978299 to your computer and use it in GitHub Desktop.
super()経由でSubの親であるBaseの__init__()を呼び出す
This file contains hidden or 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
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
# super 使う(Function.prototype.apply みたいな動き) | |
class Base(object): | |
def __init__(self): | |
print('Base') | |
class Sub(Base): | |
def __init__(self): | |
super(Sub, self).__init__() | |
print('Sub') | |
if __name__ == '__main__': | |
Sub() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment