-2
class Dog(object):
species = "mammal"
def __init__(self, breed, name, color):
self.breed = breed
self.name = name
sam = Dog(breed="lab", name="maorian", color="white")
그러나 "color"속성을 사용할 수 없습니다. 이유가 무엇입니까?Python 클래스의 다중 속성
감사합니다. 그러나 내가 100 가지 속성을 말하면, 이것은 너무 지저분 해지지 않습니까? –
@ Nirupbelongokar 백가지 속성이 있다면 코드 냄새가 난다. https://sourcemaking.com/refactoring/smells/large-class – jonrsharpe