Conversation
| if greyscale: | ||
| if not linear: | ||
| self.lut = [i8(c) for c in palette[:256]] | ||
| self.lut = list(palette[:256]) |
There was a problem hiding this comment.
In [1]: [c for c in b'test']
Out[1]: [116, 101, 115, 116]
In [2]: list(b'test')
Out[2]: [116, 101, 115, 116]|
I don't have enough permissions to restart build on Travis ( |
Maybe you do: try logging out and back in to Travis, that brought back the restart buttons for me recently. |
|
Thanks, it works) |
| if not byte: | ||
| break | ||
| byte = i8(byte) | ||
| byte = byte[0] |
There was a problem hiding this comment.
Is it just me, or is byte = byte[0] not as clear as byte = i8(byte) about what is happening here?
There was a problem hiding this comment.
You are right that i8() looks more clear at first glance. Mostly because indexing had changed from Py2 to Py3 for bytes. However, this saves one function call and type checking on each value. Also, IDEs handle types correctly and show variables as int.
There was a problem hiding this comment.
As an alternative, it is possible to change i8 and use it everywhere for consistency:
def i8(c, o=0):
return c[o]|
I've created a rebased version of this as #5156 |
s[4:]).