Created
July 5, 2013 04:30
-
-
Save dmikurube/5931621 to your computer and use it in GitHub Desktop.
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 Base(object): | |
def __init__(self, x): | |
self._hoge = x | |
@staticmethod | |
def generate(n, x): | |
if n == 0: | |
return Sub0(x) | |
return Sub1(x) | |
class Sub0(Base): | |
def __init__(self, x): | |
self._fuga = x | |
class Sub1(Base): | |
def __init__(self, x): | |
self._moga = x | |
print Base(2) | |
print Base.generate(0, 1) | |
print Base.generate(1, 2) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment