0

class Classname(object), what sort of word is 'object' in Python?

I didn't understand the answers given in the link. What is object in class Classname(object): in Python?

  • 1
    The linked answer says it as clearly as I can think of. – AKX Jun 08 '20 at 09:22
  • It's the base class of everything, of ever object, that is why it is called `object`. It's a type, just like `list` or `int` or `str`. What is it you don't understand exactly? – juanpa.arrivillaga Jun 08 '20 at 09:47

1 Answers1

0

object is a (global) variable. By default it is bound to a built-in class which is the root of the type hierarchy.

(This leads to the interesting property that you can take any built-in type, and use the __bases__ property to reach the type called object).

Everything built-in that isn't a keyword or operator is an identifier.

quoting the answere there what it is saying is, object is a predefined variable in python self, like open is a predefined function in python.

Matthijs990
  • 637
  • 3
  • 26
  • What is ```python self```? Moreover, isn't the syntax used for inheriting a class? So, how is ```object``` a variable. If it is predefined, then how to get the list of other predefined variables? –  Jun 08 '20 at 09:39