Skip to content

Instantly share code, notes, and snippets.

@dmikurube
Created July 5, 2013 04:30
Show Gist options
  • Save dmikurube/5931621 to your computer and use it in GitHub Desktop.
Save dmikurube/5931621 to your computer and use it in GitHub Desktop.
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