코드와 함께 파이썬에서 바인딩되지 않은 메서드 오류가 발생했습니다.
import random
class Sample(object):
'''This class defines various methods related to the sample'''
def drawSample(samplesize,List):
sample=random.sample(List,samplesize)
return sample
Choices=range(100)
print Sample.drawSample(5,Choices)
여기에서 많은 유용한 게시물을 읽은 후 @staticmethod코드를 작동시키기 위해 위에 추가 할 수있는 방법을 찾았습니다 . 저는 파이썬 초보자입니다. 누군가 정적 메서드를 정의하려는 이유를 설명해 주시겠습니까? 아니면 왜 모든 메서드가 정적 메서드로 정의되지 않았습니까?