Skip to content

Conversation

@Ivoah
Copy link

@Ivoah Ivoah commented Mar 7, 2016

No description provided.

pyb/pyb.py Outdated
self.f.write(b"0")

def set(self, v):
self.f.write(b"{}".format(0 if v < 0 else 255 if v > 255 else v))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I find this much clearer to read:

self.f.write(b"{}".format(max(0, min(255, v)))

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe, but it involves 2 function calls. And the original is almost plain English anyway ;-).

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should I revert it to what I had before?

@pfalcon
Copy link
Contributor

pfalcon commented Apr 18, 2016

@Ivoah : Sorry, I'm losing track of things ;-). I thought @SpotlightKid's comment was about a file already in a master, not about a pull request.

The problem with this patch is that this module is intended to emulate pyboard's "pyb" module. And pyb.LED class of pyboard doesn't have .set() method.

@Ivoah
Copy link
Author

Ivoah commented Apr 18, 2016

Well, I could always make a pull request to the main pyb module too ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants