Home >Backend Development >Python Tutorial >Python built-in function id

Python built-in function id

高洛峰
高洛峰Original
2016-11-02 14:22:111559browse

English documentation:

id(object)


Return the “identity” of an object. This is an integer which is guaranteed to be unique and constant for this object during its lifetime. Two objects with non-overlapping lifetimes may have the sameid() value.

CPython implementation detail: This is the address of the object in memory.


Description:

   1. Return the unique identifier of the object, expressed as an integer. This identifier constant is unique during the lifetime of the program.

>>> a = 1
>>> id(a)
>>> id(1.0)
>>> a = 'some text'
>>> id(a)


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn