self1 파이썬의 __init__() 의 역할 // python __init__(), constructor 객체지향언어인 파이썬은 객체지향프로그래밍을 하며(OOP) Class 기반의 모델을 기반으로 코딩을 할 수 있습니다. 파이썬에서 보여지는 기초적인 클래스의 형태는 이러합니다. class Human(): ''' Human information ''' def __init__(self, name, age, tall): #생성자 self._name = name self._age = age self._tall = tall person1 = Human('David', 28, 170) print(person1) # print(person1._name) # person1's name print >> David 클래스 내부의 주석은 개발자간 코드 가독성을 위해 권장한다고 합니다. 클래스의 가장 첫번째는 __init__().. 2022. 6. 30. 이전 1 다음