[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

What's the address for?

On Tue, Feb 19, 2019 at 7:04 AM Avi Gross <avigross at verizon.net> wrote:
> Alister wrote about the meaning of the id number often displayed about a
> python object:
> > it is the internal id of the function - Not necessarily an address, that
> is an implementation detail.
> > it is not intended for use within a program & has (almost) no practical
> use.
> I hear that it is implementation dependent. But are there any requirements
> on the implementation that allow it to have meaning? I mean is the ID
> guaranteed to be unique and not reused within a session? If two things
> concurrently show the same ID, are they the same in some way?

Have you considered reading the docs?


"""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 same
id() value."""

I'm fairly sure that answers all your questions.