* The addresses used by the loaded variable/function/macro or any symbols.
@ 2021-09-26 11:11 Hongyi Zhao
2021-09-26 11:32 ` 2QdxY4RzWzUUiLuE
0 siblings, 1 reply; 4+ messages in thread
From: Hongyi Zhao @ 2021-09-26 11:11 UTC (permalink / raw)
To: help-gnu-emacs
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.
Best, HZ
--
Assoc. Prof. Hongyi Zhao <hongyi.zhao@gmail.com>
Theory and Simulation of Materials
Hebei Vocational University of Technology and Engineering
No. 473, Quannan West Street, Xindu District, Xingtai, Hebei province
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: The addresses used by the loaded variable/function/macro or any symbols.
2021-09-26 11:11 The addresses used by the loaded variable/function/macro or any symbols Hongyi Zhao
@ 2021-09-26 11:32 ` 2QdxY4RzWzUUiLuE
2021-09-26 12:00 ` Hongyi Zhao
0 siblings, 1 reply; 4+ messages in thread
From: 2QdxY4RzWzUUiLuE @ 2021-09-26 11:32 UTC (permalink / raw)
To: help-gnu-emacs
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.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: The addresses used by the loaded variable/function/macro or any symbols.
2021-09-26 11:32 ` 2QdxY4RzWzUUiLuE
@ 2021-09-26 12:00 ` Hongyi Zhao
2021-09-26 12:16 ` 2QdxY4RzWzUUiLuE
0 siblings, 1 reply; 4+ messages in thread
From: Hongyi Zhao @ 2021-09-26 12:00 UTC (permalink / raw)
To: help-gnu-emacs
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
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-09-26 12:16 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-09-26 11:11 The addresses used by the loaded variable/function/macro or any symbols Hongyi Zhao
2021-09-26 11:32 ` 2QdxY4RzWzUUiLuE
2021-09-26 12:00 ` Hongyi Zhao
2021-09-26 12:16 ` 2QdxY4RzWzUUiLuE
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.