Skip to content

Conversation

@LRGH
Copy link

@LRGH LRGH commented Mar 15, 2017

Because import builtins fails on default installs of python2, and it is not necessary to deal with the fact that bytes is different from python2 to python3.

@bdcht
Copy link
Owner

bdcht commented Mar 17, 2017

I'd rather prefer a solution where we can still choose to rely on builtins: on ImportError you define a 'newbytes(x)' function that unpacks or packs depending on 'x'.

@LRGH
Copy link
Author

LRGH commented Mar 17, 2017

Why do you want to hide the difference between packing and unpacking?
I find it always easier to understand when the type of the variables is explicit.

@bdcht
Copy link
Owner

bdcht commented Mar 17, 2017

the goal is not to hide x type, but to still allow the use of builtins module while minimising modified loc. Rather than defining only a 'newbytes' then define 2 funcs: a 'byteslist' for unpacks and a 'newbytes' for packs so that at import time we can choose which implementation (builtins or struct based) to use.

@LRGH
Copy link
Author

LRGH commented Mar 17, 2017

But the builtins modules provides a big machinery that in the case of crysp is not needed: the use of struct.pack and struct.unpack is sufficient. Why would you want to use builtins?
Nevertheless, I agree that my patch is not optimal, I created a few unnecessary intermediate local variables e.g. in crc.py.

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.

2 participants