Today I have discovered that python object without __mro_entries__
can be used as a base class.
Example:
class Base:
def __init__(self, *args):
self.args = args
def __repr__(self):
return f'{type(self).__name__}(*{self.args!r})'
class Delivered(Base):
pass
b = Base()
d = Delivered()
class Foo(b, d):
pass
print(type(Foo) is Delivered)
print(Foo)
True
Delivered(*('Foo', (Base(*()), Delivered(*())), {'__module__': '__main__', '__qualname__': 'Foo'}))
As a result Foo
will be instance of a Delivered
class and it's not a valid type.
I do understand use case of __mro_entries__
but what use case of using object without __mro_entries__
as a base class. Is it a bug at python?