0

I am confused on what the folowing means:

class class_name(object):

What does the class takes in between the parenthesis? is it inheritance?

kartikeykant18
  • 1,645
  • 5
  • 25
  • 39

4 Answers4

1

It's the superclass. There can be more than one, though getting that right and making it useful can be a bit tricky. There can also be none, but unless you're on Python 3, that's a bad idea.

user2357112
  • 235,058
  • 25
  • 372
  • 444
0

Basically it is inheritance. You might find this thread and some of the related links useful: Python class inherits object.

Community
  • 1
  • 1
Tim Wilder
  • 1,547
  • 1
  • 17
  • 26
0

Yes. It's inheritance. This is what it looks like:

class DerivedClass(BaseClass)

In your declaration, you're basically inheriting the object type. It's a built-in. However, in Python 3 you don't need to do this, as every class is implicitly a subclass of object.

By the way, more about this here.

aIKid
  • 24,039
  • 4
  • 38
  • 65
0
class class_name(object):

This is called inheritance
Python also supports multiple inheritance , that means you can inherit from multiple classes
for example:
class class_name(BaseClassName1,BaseClassName2,BaseClassName3):

Odai Al-Ghamdi
  • 302
  • 2
  • 12