MCPcopy Create free account
hub / github.com/bslatkin/effectivepython / __set__

Method __set__

example_code/item_060.py:217–220  ·  view source on GitHub ↗
(self, instance, value)

Source from the content-addressed store, hash-verified

215 return getattr(instance, self.internal_name)
216
217 def __set__(self, instance, value):
218 if not (0 <= value <= 100):
219 raise ValueError("Grade must be between 0 and 100")
220 setattr(instance, self.internal_name, value)
221
222
223print("Example 16")

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected