In python everything is object. An object is a piece of code that is characterized by:
- Data
- Methods: These are mechanisms for manipulating data
Creating the object
A character chain object is created in the space of objects via the character 'or '.
Method calls are made via a point:
'hello'.upper()
A variable name allows you to store a reference to the object:
counter 1
The variable called object 1 reference counter
In python the variable name contains letters and numbers but cannot start with a number. A good practice is to give a good variable name.
Example:
ma_variable 5
Dereference:
ma_variable - 'HELLO'
Python is strong typing language, the type is related to the object and not to the variable.
del ma_variable
The del control removes the variable from the space of the variables. If the object no longer has a reference, a mechanism for the release of memory is activated: the garbage collector.