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
)
相关问题
- how to define constructor for Python's new Nam
- streaming md5sum of contents of a large remote tar
- How to get the background from multiple images by
- Django __str__ returned non-string (type NoneType)
- Evil ctypes hack in python
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).