NoInheritFromObjectRule
In Python 3, a class is inherited from object
by default.
Explicitly inheriting from object
is redundant, so removing it keeps the code simpler.
Message
Inheriting from object is a no-op. ‘class Foo:’ is just fine =)
Has Autofix: Yes
VALID Code Examples
# 1:
class A(something): pass
# 2:
class A:
pass
INVALID Code Examples
# 1:
class B(object):
pass
Autofix:
---
+++
@@ -1,3 +1,3 @@
-class B(object):
+class B:
pass
# 2:
class B(object, A):
pass
Autofix:
---
+++
@@ -1,3 +1,3 @@
-class B(object, A):
+class B(A):
pass