Steven D'Aprano added the comment:
I don't think this is a bug, I think it is standard behaviour which should be
expected if you think about Python's execution model. If you inherit from
object implicitly:
class Spam: ...
then the interpreter gets to pick the base class, and it uses the genuine,
builtin object base class. There's no name lookup, it is all built into the
guts of the interpreter.
But if you specify the name of a base class:
class Spam(foo): ...
then foo is looked up at runtime, regardless of whether you type "foo" or "int"
or "str" or "object". If you have replaced or shadowed the builtin object with
your own class, then you'll get *that* as the base for Spam, not the real
built-in object base class.
----------
nosy: +steven.daprano
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue31283>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com