[issue36175] Identity of bound methods

2019-03-03 Thread Abe Leite
Abe Leite added the comment: Thank you for the explanation. I looked up the documentation for descriptors and I understand better now. I appreciate it! -Abe -- ___ Python tracker __

[issue36175] Identity of bound methods

2019-03-03 Thread Inada Naoki
Inada Naoki added the comment: > > Could you explain (or send me a link to) what happens when an instance method > is accessed descriptor of function object creates bound method. You can google "descriptor python". > and why this should be different from what happens when an unbound method

[issue36175] Identity of bound methods

2019-03-03 Thread Abe Leite
Abe Leite added the comment: Hi Inada-san, Could you explain (or send me a link to) what happens when an instance method is accessed and why this should be different from what happens when an unbound method is accessed? The `is` keyword has been very useful for me in introspection cases and

[issue36175] Identity of bound methods

2019-03-03 Thread Inada Naoki
Inada Naoki added the comment: It is a designed behavior. I agree that it looks strange to some users who don't know implementation. And that's why people should not use `is` normally, except some use cases (e.g. `is None`.) -- nosy: +inada.naoki resolution: -> not a bug stage: ->

[issue36175] Identity of bound methods

2019-03-03 Thread Abe Leite
New submission from Abe Leite : The following code produces unexpected behavior in all versions of Python I have tested. >>> class a: ... def method(self): pass >>> inst = a() >>> inst.method is inst.method False It appears that id(inst.method) changes each time inst.method is accessed b