Closed as not planned
Description
Bug report
Repro:
class MyClass(object):
def __init__(self, x):
self.x = x
def add(self, y):
return self.x + y
a = MyClass(2)
print(inspect.getattr_static(a, "add"))
print(getattr(a, "add"))
Result:
<function MyClass.add at 0x7fec4ebe9310>
<bound method MyClass.add of <__main__.MyClass object at 0x7fec4fca3490>>
I'm not sure if this is a bug, but I'd like to understand the reason behind the difference. Since function
and bound method
are different type in Python, I think it should be a bound method
in my case, but why inspect.getattr_static
return function
type?
Your environment
- CPython versions tested on:
- Operating system and architecture: