I've been doing things in Python for over 20 years. Only recently I learn that I can do this.
>>> Dog.__bases__ = (Cat,)
>>> isinstance(dog, Dog)
True
>>> isinstance(dog, Cat)
True
>>>I've been doing things in Python for over 20 years. Only recently I learn that I can do this.
>>> Dog.__bases__ = (Cat,)
>>> isinstance(dog, Dog)
True
>>> isinstance(dog, Cat)
True
>>>
This is wild. Is it part of Python's specification, or an implementation detail of CPython?
As far as I understand, CPython implementation is THE specification. Some billions dollar ERP system firmly rely on this behavior, btw.