[issue15885] @staticmethod __getattr__ doesn't work

Eric Snow report at bugs.python.org
Sun Sep 9 05:04:18 CEST 2012


Eric Snow added the comment:

In Python 2 the code example generates an old-style class.  When I tried it with a new style class, it worked fine:

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

a = Wrapper()
print(a.foo)
# 'foo'

Chalk this up to another reason to move to Python 3.  <wink>

----------
nosy: +eric.snow
resolution:  -> rejected
status: open -> closed

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue15885>
_______________________________________


More information about the Python-bugs-list mailing list