[Tutor] __getattr__ can't be a staticmethod?

inhahe inhahe at gmail.com
Sat May 24 01:52:22 CEST 2008


why doesn't this work?

>>> class a:
...   @staticmethod
...   def __getattr__(attr):
...     return "I am a dork"
...
>>> f = a()
>>> f.hi
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: 'staticmethod' object is not callable


More information about the Tutor mailing list