Everything is an object in python - object class and type class

Marko Rauhamaa marko at pacujo.net
Wed Jun 3 08:08:51 EDT 2015


BartC <bc at freeuk.com>:

> To 'variable' and 'type', you might need to add 'value' to make it more
> complete.

'Value' and 'object' are indeed synonymous as long as you keep in mind
that:

    >>> -12 == -12
    True
    >>> -12 is -12
    False

IOW, the literal expression -12 happens to construct a fresh
value/object each time CPython parses it.

> You might call such a value an 'object'. The trouble is, Python also
> uses 'object' to mean the base class of all classes.

'object' is the class of all objects just like 'int' is the class of all
integers. So no trouble at all.

> And it seems to use it in a more abstract sense as well to mean pretty
> much everything. While other languages, such as C, use object in yet
> another way.
>
> Which is where the term breaks down as it no longer helps in
> understanding. It's become meaningless.

Correct! Abstractions are generalizations of specifics. You can't
understand the generalizations before being bored with the specifics
first.


Marko



More information about the Python-list mailing list