Unnecessary inheriting from object

A class is inherited from object by default, so explicitly inheriting from object is redundant. Removing it keeps the code simpler.

A technical reason for inheriting from object could be when writing code that is compatibility with Python 2.7: Python 3 classes inherits from object by default, but Python 2.7 classes do not.

Note though that Python 2.7 has already reached "End Of Life" and is no longer supported by the Python Software Foundation. For this reason your code might not need to support Python 2.7 either.

Moreover, it takes more than inheriting classes from object to make your codebase backwards compatible with Python 2.7: you must not use any new feature of Python 3...ever. That's some serious dedication to a dead language.

Given that all three of these class definitions are completely equivalent:

Why not choose the easiest to both read and write (the first one)

If our GitHub code review bot spots this issue in your pull request it gives this advice:

code-review-doctorbotsuggested changes just now
helpers.py
1
+
class FooBarClass(object):
Suggested changes
-
class FooBarClass(object):
+
class FooBarClass:
Commit suggestion

A class is inherited from object by default, so explicitly inheriting from object is redundant. Removing it keeps the code simpler.

Read more
2
+
    pass
Update helpers.py
We're your Python code review copilot. Get code improvements right in your pull request with our GitHub code review bot.

Configuring this check

Code Review Doctor will run this check by default. No configuration is needed but the check can be turned on/off using check code inheriting-from-object in your pyproject.toml file.

Read more about configuring Code Review Doctor.