[New-bugs-announce] [issue15885] @staticmethod __getattr__ doesn't work
Albert Zeyer
report at bugs.python.org
Sun Sep 9 02:15:09 CEST 2012
New submission from Albert Zeyer:
Code:
```
class Wrapper:
@staticmethod
def __getattr__(item):
return repr(item) # dummy
a = Wrapper()
print(a.foo)
```
Expected output: 'foo'
Actual output with Python 2.7:
Traceback (most recent call last):
File "test_staticmethodattr.py", line 7, in <module>
print(a.foo)
TypeError: 'staticmethod' object is not callable
Python 3.2 does return the expected ('foo').
PyPy returns the expected 'foo'.
----------
components: Interpreter Core
messages: 170070
nosy: Albert.Zeyer
priority: normal
severity: normal
status: open
title: @staticmethod __getattr__ doesn't work
versions: Python 2.7
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue15885>
_______________________________________
More information about the New-bugs-announce
mailing list