5 ms·
I would also change h.lights.get('l3') to h.lights[l3] by defining __getitem__(). Possibly even cut this back to h[13], as you'll always be referring to the lig
by timClicks 14y ago
I would also change h.lights.get('l3') to h.lights[l3] by defining __getitem__(). Possibly even cut this back to h[13], as you'll always be referring to the lights.
- masklinn 14y agoAnd setState should probably take kwargs rather than a dict of arguments. Might also be cool to use a context manager for a "complex send" e.g. with light: light.bri(220) light.alert("select") which would only send the whole request at once in __exit__, as in "transactional" APIs.
- izak30 14y agoI do really like this one. Been trying to think of a decent way to do pipelining. If you haven't noticed, it is possible to do chaining with the existing API, but it's one request/call.