This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author lgj1993
Recipients lgj1993
Date 2019-03-01.10:01:47
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1551434507.65.0.524954785734.issue36156@roundup.psfhosted.org>
In-reply-to
Content
>>> class A:
...     def a(self):
...         return 0
...     def a1(self):
...         return 1
...
>>> a =A()
>>> id(a.a)
4316559496
>>> id(a.a1)
4316559496
>>> id(a)
4318155272
It' seems oops , according to the id function source code.
here is the description of builtin_id function in Python/bltinmodule.c
/* 
Return the identity of an object.

This is guaranteed to be unique among simultaneously existing objects.
(CPython uses the object's memory address.)
[clinic start generated code]*
/
It seems should return different value, but id(a.a) as same as 
id(a.a1), Is it a bug?
History
Date User Action Args
2019-03-01 10:01:47lgj1993setrecipients: + lgj1993
2019-03-01 10:01:47lgj1993setmessageid: <1551434507.65.0.524954785734.issue36156@roundup.psfhosted.org>
2019-03-01 10:01:47lgj1993linkissue36156 messages
2019-03-01 10:01:47lgj1993create