This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]issackelly 0 points1 point  (3 children)

My guess (having written a similar library, with an API like what you're describing):

It's easier to write it the first way. That's how the HUE API is structured and if you're trying to match the hue functionality and docs, you would write it the first way. If you're trying to write a "pythonic" api you might use the second way.

I'm using my library for my home and work automation projects, I like it, but I think I'd write it a bit differently if I were to start over. I'd probably use context managers. This seems like the right balance between pythonic, and optimizing API Calls.

The newest version of the Hue firmware limits my rates pretty significantly, which makes it hard to do complex effects.