Reputation: 1055
I noticed all 3 -> class foo
, class foo()
and class foo(object)
can be used but i am confused as to what is the difference between these 3, if there is any? (I mean in properties mainly, python3
)
Upvotes: 15
Views: 4142
Reputation: 160377
Let's break them down:
class foo
:
object
as the base class for you. classobj
that will cause you all sorts of headaches.class foo()
:
class foo
for both Python versions, trim it off, it looks ugly and makes no difference. class foo(object)
:
2
too, explicitly inheriting from object causes the class to be new style in Python 2 and makes no difference in 3 (apart from some extra typing).Upvotes: 26