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

Class BoundedResistance

example_code/item_058.py:116–128  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

114
115print("Example 8")
116class BoundedResistance(Resistor):
117 def __init__(self, ohms):
118 super().__init__(ohms)
119
120 @property
121 def ohms(self):
122 return self._ohms
123
124 @ohms.setter
125 def ohms(self, ohms):
126 if ohms <= 0:
127 raise ValueError(f"ohms must be > 0; got {ohms}")
128 self._ohms = ohms
129
130
131print("Example 9")

Callers 1

item_058.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected