On Jan 18, 2008 2:01 PM,  <[EMAIL PROTECTED]> wrote:
> Now here is another one for your enjoyment:
>
> class C:
>         @staticmethod
>         def f1(): pass
>         F = { '1' : f1 }
>
> C().F['1']()
>
> >>> TypeError: 'staticmethod' object is not callable
>
>
> What do you think of this one?

I'll get the ball rolling again, and hopefully it won't roll over me. ;)

The decoration is setting the class type's f1 attribute correctly, but
doing something strange in the local namespace.

>>> class C:
...   @staticmethod
...   def f1(): pass
...   print f1
...
<staticmethod object at 0x00A69A70>
>>> print C.f1
<function f1 at 0x00A60830>

The class statement's local namespace is pretty strange. I think I
mightl go back to pretending there isn't one.

-- 
Neil Cerutti
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to