[issue40032] Remove explicit inheriting of object in class definitions

Steven D'Aprano report at bugs.python.org
Sat Mar 21 10:42:43 EDT 2020


Steven D'Aprano <steve+python at pearwood.info> added the comment:

On Sat, Mar 21, 2020 at 01:30:13PM +0000, Julin wrote:
> Why do you think it makes the code less clear, though?

Classes that inherit from object, and those which don't ("classic 
classes") behave differently in Python 2. But in Python 3, they are 
precisely the same.

Anyone who is familiar with Python 2, perhaps because they still have to 
deal with a legacy code base, or just because they learned using that 
version, will have to mentally adjust each time they see something which 
looks like a classic class, but actually is a new-style type.

Beginners who are only starting to learn Python may not understand the 
type hierarchy, and may believe that a class that doesn't explicitly 
inherit from object is a stand-alone class that doesn't inherit from 
object. Perhaps they have come from another language with different 
rules, or that lacks a single base object, like Python originally did.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue40032>
_______________________________________


More information about the Python-bugs-list mailing list