[퍼옴] @staticmethod, @classmethod 차이
참조: https://blog.naver.com/parkjy76/30167615254 Python에서는 static(정적) 메소드를 데코레이터로 정의 할 수 있는데 @staticmethod, @classmethod를 사용한다. 이 둘의 차이점은 classmethod의 경우는 첫번째 인수가 클래스를 지정하는데 반해 staticmethod는 이런 룰이 없다. 이로 인해 상속받는 경우 동작이 달라진다. class foo(object): name = 'foo' @staticmethod def get_name_static(): print foo.name @classmethod def get_name_class(cls): print cls.name 실행 결과는 아래와 같다.>>> foo.get_name_static..
BackEnd/Python
2018. 2. 1. 21:39
공지사항
최근에 올라온 글
링크
TAG
- Java
- ML
- mysql
- tensorflow
- 텐서플로우
- 점프투파이썬
- 파이썬
- API
- Configuration
- serverless
- TDD
- python
- AWS
- web
- javascript
- AI
- memory
- 머신러닝
- spark
- Error
- Docker
- NIO
- 중앙정보처리학원
- BigData
- executor
- mybatis
- Maven
- Gradle
- 모두의딥러닝
- spring
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
글 보관함