staticmethod makes my brain hurt

Ian Kelly ian.g.kelly at gmail.com
Thu Nov 17 02:37:57 EST 2011


On Wed, Nov 16, 2011 at 11:44 PM, Dotan Cohen <dotancohen at gmail.com> wrote:
> Try this (untested):
>
> class C:
>   @staticmethod
>   def foo():
>       pass
>
>   print "inside", C.foo, callable(C.foo)

If you had tested this, you would have found that you get a NameError,
since C is not yet bound inside the class block where you define it.



More information about the Python-list mailing list