What is the id( ) function used for?

前端 未结 13 1152
傲寒
傲寒 2020-11-22 10:51

I read the Python 2 docs and noticed the id() function:

Return the “identity” of an object. This is an integer (or long integer) which is

13条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-11-22 11:00

    I am starting out with python and I use id when I use the interactive shell to see whether my variables are assigned to the same thing or if they just look the same.

    Every value is an id, which is a unique number related to where it is stored in the memory of the computer.

提交回复
热议问题