On Fri, May 23, 2008 at 7:52 PM, inhahe <[EMAIL PROTECTED]> wrote:
> 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

I don't know why you are getting that specific error, but what are you
trying to do? This code doesn't make sense. __getattr__() is the hook
for getting attributes of an object; staticmethods aren't associated
with any object. What attributes do you want to get?

Kent
_______________________________________________
Tutor maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/tutor

Reply via email to