Avatar ·

What is an object in Python. Why is ID(A) == ID(b) == ID(1)?

📁 Advanced Python Topics, example, AI, book, work

"

Detail the question.
In Python books, they write that everything in Python is an object.

We take a traditional approach to learning/teaching programming languages. Languages like Pascal, C, C++ have the concept of "variable name" (identifier). The value is bound/assigned to a variable name - this is a way (in the original text of the program) to refer to a memory cell to obtain the value stored there. That is, it means that somewhere a variable is stored at a certain address and it is connected with the address of the cell.

Now we go to Python. Object.

  a = 1 print (a) a = "He