class Foo():
def __init__(self):
pass
def create_another(self):
return Foo()
# is not working as intended, because it will make y below becomes Foo
class Bar(Foo):
pass
x = Bar()
y = x.create_another()
y 应该是 Bar 类而不是 Foo。
有没有类似的东西:self.constructor()
改为使用?