[issue36156] different method, but id function return same value.

2019-03-01 Thread lgj


New submission from lgj <929102...@qq.com>:

>>> 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?

--
components: Library (Lib)
messages: 336912
nosy: lgj1993
priority: normal
severity: normal
status: open
title: different method, but id function return same value.
type: behavior
versions: Python 3.6

___
Python tracker 
<https://bugs.python.org/issue36156>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue36163] same object, same method, but the is keyword return false.

2019-03-01 Thread lgj


New submission from lgj <929102...@qq.com>:

>>> class A():
...   def a(self):
...   pass
...
>>> a = A()
>>> a is a
True
>>> a.a is a.a
False
>>> id(a.a)
4532803784
>>> id(a.a)
4532803784
It's seems quite oops.

--
messages: 336979
nosy: lgj1993
priority: normal
severity: normal
status: open
title: same object, same method, but the is keyword return false.
type: behavior
versions: Python 3.6

___
Python tracker 
<https://bugs.python.org/issue36163>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com