메소드
-
Python Class - 3Programming/python 2021. 6. 24. 22:19
왜 클래스의 메소드 앞에는 self가 붙을까? class Student(): # 클래스 변수 student_count = 0 def __init__(self, name, number): # 인스턴스 변수 self._name = name self._number = number Student.student_count += 1 def __str__(self): return 'str {}'.format(self._name) def __repr__(self): return 'repr {}'.format(self._name) def detail_info(self): print('current id = {}'.format(id(self))) print('Student detail info : {} {}'.format..