Is this a bug, or is it me?

Arnaud Delobelle arnodel at googlemail.com
Sat Jan 19 04:36:24 EST 2008


On Jan 18, 7:01 pm, cptnwill... at gmail.com wrote:
> I filed a bug report, and here is the short answer to my question:
> genexps are code blocks, and code blocks cannot see variables in class
> scopes. Congrats to Neil Cerutti who figured it out.
>
> 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?

It's normal, the staticmethod decorator's role is to 'flag up' the
method as static for further processing when type(C).__new__ is
called.

--
Arnaud




More information about the Python-list mailing list