user6774416 user6774416 - 1 year ago 65
Python Question

Custom classes with empty __bases__ attribute

In the section on Custom Classes of The Python Language Reference it is stated that:

Special attributes:
is the class name;
is the module name in which the class was defined;
is the dictionary containing the class’s namespace;
is a tuple (possibly empty or a singleton) containing the base classes, in the order of their occurrence in the base class list;
is the class’s documentation string, or
if undefined.

for a custom class can "possibly be empty"? How can that be achieved if everything implicitly inherits from
in Python

The only class with an empty

>>> object.__bases__

Am I missing something?

wim wim
Answer Source

The line has been there since before Python 3 was released. Here's the 2007 commit. When the object model was revamped to get rid of old-style classes, it looks like that information in the docs slipped through review and is likely just misinformation now.

May I suggest you raise a documentation issue to clear up whether it is incorrect/outdated.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download