classmethod와 abstractmethod를 비슷한 방법으로 사용을 할 수 있다. 우선 classmethod와 비교가 되는것이 staticmethod이다. 간단하게 classmethod와 staticmethod가 어떤건지 부터 비교를 해보자. @ staticmethod p.py 1 2 3 4 5 6 7 8 9 10 11 12 class MethodTest(object): __c_test = 1 def __init__(self): pass @staticmethod def s_print(): print ( 'is staticmethod' ) MethodTest.s_print() MethodTest.s_print() MethodTest.s_print() cs $python p.py >>> is staticmethod is staticmethod is staticmethod staticmethod는 해당 클래스를 namespace처럼 사용하기 위해 사용을 한다. 즉 해당 객체를 생성하지 않아도 해당 클래스 이름만 가지고 해당 method를 호출을 할 수있다. staticmethod는 self인자를 받지 않는다. @ classmethod p.py 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 class MethodTest(object): __c_test = 1 def __init__(self): pass @classmethod def c_print(cls): cls.__c_test + = 1