correctly override __new__ in python3
问题 So I am trying override __new__ and let it exist as a factory to create derived instances. After reading a bit on SO, I am under the impression that I should be calling __new__ on the derived instance as well. BaseThing class BaseThing: def __init(self, name, **kwargs): self.name = name # methods to be derived ThingFactory class Thing(BaseThing): def __new__(cls, name, **kwargs): if name == 'A': return A.__new__(name, **kwargs) if name == 'B': return B.__new__(name, **kwargs) def __init__