help-gnu-emacs
[Top][All Lists]
Advanced

[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


From: Hongyi Zhao
Subject: Re: The addresses used by the loaded variable/function/macro or any symbols.
Date: Sun, 26 Sep 2021 20:00:06 +0800

On Sun, Sep 26, 2021 at 7:33 PM <2QdxY4RzWzUUiLuE@potatochowder.com> wrote:
>
> On 2021-09-26 at 19:11:45 +0800,
> Hongyi Zhao <hongyi.zhao@gmail.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
> instance.
>
> 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.

Thank you for your systematic and thorough explanation. These
conclusions cannot be drawn by built-in help alone, as shown below:

In [1]: id?
Signature: id(obj, /)
Docstring:
Return the identity of an object.

This is guaranteed to be unique among simultaneously existing objects.
(CPython uses the object's memory address.)
Type:      builtin_function_or_method

Best, HZ



reply via email to

[Prev in Thread] Current Thread [Next in Thread]