Question
Asked By – Falmarri
Is there a difference between
class A:
...
and
class A():
...
I just realized that a couple of my classes are defined as the former and they work just fine. Do the empty parenthesis make any difference?
Now we will see solution for issue: Python class definition syntax
Answer
The latter is a syntax error on older versions of Python. In Python 2.x you should derive from object
whenever possible though, since several useful features are only available with new-style classes (deriving from object
is optional in Python 3.x, since new-style classes are the default there).
This question is answered By – Ignacio Vazquez-Abrams
This answer is collected from stackoverflow and reviewed by FixPython community admins, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0