variable vs. object

Marko Rauhamaa marko at pacujo.net
Mon Nov 30 00:28:06 EST 2015


fl <rxjwg98 at gmail.com>:

> I read several parts on line about Python that everything in Python is
> an object.

Python has two distinct entities: objects and references.

All numbers, strings, classes, modules, class instances, files etc are
objects.

Variables, however, are not objects. They are references. Here are
different references:

   a                  # variable
   a.x                # attribute
   a[3]               # subscription

> Yes, it is a key difference with other languages.

Python shares this feature with many higher-level languages.


Marko



More information about the Python-list mailing list