Skip to content

Instantly share code, notes, and snippets.

@shelling
Created January 15, 2010 10:13
Show Gist options
  • Select an option

  • Save shelling/277944 to your computer and use it in GitHub Desktop.

Select an option

Save shelling/277944 to your computer and use it in GitHub Desktop.
show how to write a class method in Python
class Hello():
def world(self):
return "world"
world = classmethod(world)
def foo():
return "foo"
foo = staticmethod(foo)
@classmethod
def bar():
return "bar"
print Hello.world()
print type(Hello.world)
print type(classmethod)
print Hello.foo()
print Hello.bar()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment