Message336912
>>> 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? |
|
Date |
User |
Action |
Args |
2019-03-01 10:01:47 | lgj1993 | set | recipients:
+ lgj1993 |
2019-03-01 10:01:47 | lgj1993 | set | messageid: <1551434507.65.0.524954785734.issue36156@roundup.psfhosted.org> |
2019-03-01 10:01:47 | lgj1993 | link | issue36156 messages |
2019-03-01 10:01:47 | lgj1993 | create | |
|