Python Basic Doubt
Steven D'Aprano
steve+comp.lang.python at pearwood.info
Sun Aug 11 04:29:46 EDT 2013
On Sat, 10 Aug 2013 16:42:22 -0400, Roy Smith wrote:
> In article <mailman.439.1376166663.1251.python-list at python.org>,
> Dennis Lee Bieber <wlfraed at ix.netcom.com> wrote:
>
>> Because id(n) is not giving you the address of the NAME. It is giving
>> you the address of the "10"
>
> Actually, it is giving you the id of the int(10) object. Maybe it's an
> address, maybe it's not. Only your implementation knows for sure.
/steve cheers from the audience
Thank you for mentioning this. Using Jython:
>>> x = 10
>>> id(x)
1
And using IronPython:
>>> x = 10
>>> id(x)
43
"id" does not stand for "memory address". It stands for "identity".
--
Steven
More information about the Python-list
mailing list