Skip to content

Instantly share code, notes, and snippets.

@andrewgodwin
Created June 27, 2014 20:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andrewgodwin/064b7b5d1adf6e8533b3 to your computer and use it in GitHub Desktop.
Save andrewgodwin/064b7b5d1adf6e8533b3 to your computer and use it in GitHub Desktop.
class X:
@staticmethod
def y(self):
return 3
z = [y]
>>> X.y
<function X.y at 0x7fc5e5ca90d0>
>>> X.z[0]
<staticmethod object at 0x7fc5e5ca26a0>
>>> X.y()
3
>>> X.z[0]()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: 'staticmethod' object is not callable
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment