변경할 때 속성을 어설트 할 수 있습니까 (디버깅 목적으로)?속성 집합에 파이썬 assert
class MyClass(object):
def set_my_property(self, value):
self.my_property = value
# TODO: mark my_property so that if it gets set again, an assert
# is triggered
c = MyClass()
c.set_my_property(4)
# any of these lines would cause an assertion
c.set_my_property(8)
c.my_property = 123
무슨 뜻인지 예를 들려 주시겠습니까? –
@jcomeau_ictx : done –