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?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The latter is a syntax error on older versions of Python. In Python 2.x you should derive from
objectwhenever possible though, since several useful features are only available with new-style classes (deriving fromobjectis optional in Python 3.x, since new-style classes are the default there).