Created
September 8, 2011 05:40
-
-
Save sonkm3/1202710 to your computer and use it in GitHub Desktop.
python classmethod/staticmethod
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
class Foo(object): | |
def method_1(self): | |
print self | |
@classmethod | |
def classmethod_1(cls): | |
print cls | |
@staticmethod | |
def staticmethod_1(): | |
print Foo | |
foo = Foo() | |
foo.method_1() | |
foo.classmethod_1() | |
foo.staticmethod_1() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment