Rohit Kumar
Rohit Kumar

Reputation: 2031

Class declaration in python with or without object in parameter

What is difference between these two type of class declarations?

class ClassName():

class ClassName(object):

What does this object parameter does?

Upvotes: 0

Views: 65

Answers (1)

user554538
user554538

Reputation:

In Python 2 from 2.1, there are two kinds of classes, new-style and classic. Deriving from object in Python 2, from 2.1 on, will create a new-style class. In Python 3, there's only one kind, and so both forms are the same.

Upvotes: 1

Related Questions