[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: The addresses used by the loaded variable/function/macro or any symb
Re: The addresses used by the loaded variable/function/macro or any symbols.
Sun, 26 Sep 2021 04:32:44 -0700
On 2021-09-26 at 19:11:45 +0800,
Hongyi Zhao <email@example.com> wrote:
> In Python, there is a function named as `id()', which can be used to
> check the address of the loaded symbols. I want to know if there is a
> similar function in Emacs for this purpose.
I don't know about Emacs, but that's not quite what id() does in Python.
In Python, id() returns a unique, opaque identifier that identifies a
value. That uniqueness, however, is only guaranteed for the lifetime of
that value; often, ids are reused over the life of an interpreter
As an implementation detail, id() in CPython happens to return the
machine address of the value. But id() in Jython returns an integer
that's some sort of counter or index into some internal structure.
Other implementations have other methods of keeping track of values, but
the temporal uniqueness semantic remains the same.