July 8, 2020
8:49 a.m.
On Wed, Jul 08, 2020 at 04:19:32PM +0100, Jonathan Fine wrote:
For example, suppose we want limits on the room temperature, that the thermostat cannot override. >>> aircon_clipper = Clamper(50, 80)
>>> thermostat_temp = 40 >>> target_temp = aircon_temp_clipper(thermostat_temp) >>> target_temp 50
Here you go: aircon_clipper = functools.partial(math.clamp, lower=50, upper=80) Relevent: https://steve-yegge.blogspot.com/2006/03/execution-in-kingdom-of-nouns.html -- Steven