[Tutor] Python 3 only: Better to use implicit or explicit "object" in class statements?
boB Stepp
robertvstepp at gmail.com
Sun Jun 7 13:51:33 EDT 2020
Now in "4.1 Classes" at
https://dabeaz-course.github.io/practical-python/Notes/04_Classes_objects/01_Class.html.
Basic question for Python 3 only development: Is it better style to use
"class ClassName:" or "class ClassName(object):"? Beazley uses the former
in this material (so far). Other readings online (no citations handy)
prefer being explicit with the latter. I note that pylint prefers omitting
"(object)", calling it "useless-object-inheritance".
I realize that if I am trying to write code compatible with both Python 2
and 3 that I need to explicitly inherit from "object".
So, for Python 3 only development is there any consensus? Are there any
real arguments for being "explicit" with inheriting from "object"? I have
to say that I have not yet found the allusion to Zen to be explicit not
convincing.
--
Wishing you only the best,
boB Stepp
More information about the Tutor
mailing list