Python Variables, Names, and Binding

Having objects isn’t useful unless there is a way to use them. In order to use an object, there must be a way to reference them. In Python this is done by binding objects to names. A detailed overview of can be found here

One way this is done is by using an assignment statement. This is commonly called assigning a variable in the context of Python. If speaking about programming in the context of other languages, binding an object to a name may be more precise.

>>> some_number = 1
>>> print(some_number)

In the example above, the target of the assignment statement is a name (identifier), some_number. The object being assigned is the number 1. The statement binds the object to the name. The second statement, we use this binding print the object that some_number refers to.

The identifier is not preceeded by a type. That is because Python is dynamically-typed language. The identifier is bound to an object that does have a type, however, the identifier itself can be rebound to another object of a different type:

>>> some_variable = 1
>>> print(some_variable)
>>> some_variable = "Hello campers!"
>>> print(some_variable)
Hello campers!