我有一种奇怪的感觉,这是一个简单的问题。
我希望能够为类类型“别名”,以便可以在包级别换出实现。我不想import X as bah
在我的代码中分散 X 数量...
阿卡。我怎样才能做类似下面的事情:
class BaseClass(object):
def __init__(self): pass
def mymthod(self): pass
def mymthod1(self): pass
def mymthod2(self): pass
class Implementation(BaseClass):
def __init__(self):
BaseClass.__init__()
单独包装...
#I dont want thse scattered through out modules,
#i want them in one place where i can change one and change implementations
#I tried putting it in the package init but no luck
import Implementation as BaseClassProxy
class Client(BaseClassImpl):
def __init__(self):
BaseClassImpl.__init__(self)