[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:


class Wrapper:
        def __getattr__(item):
                return repr(item) # dummy

a = Wrapper()

Expected output: 'foo'

Actual output with Python 2.7:

Traceback (most recent call last):
  File "test_staticmethodattr.py", line 7, in <module>
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>

More information about the New-bugs-announce mailing list