You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Of course, if you are want to keep Python 2 support, then you would need to keep the current solution. I don't know if other languages support something like this, but if so, then dropping Python 2 support would be a small price to pay.
I am filing this issue as something to possibly consider for the future.
Currently struct is used for converting bytes to ints (and a few other values like floats, but this issue is only about ints):
https://github.com/kaitai-io/kaitai_struct_python_runtime/blob/master/kaitaistruct.py#L170
For ints Python 3 has a different mechanism for converting from byte strings to ints namely
from_bytes()
:https://docs.python.org/3/library/stdtypes.html#int.from_bytes
What is very convenient is that it allows arbitrary length byte strings, so it becomes absolutely trivial to implement something like
u3
oru5
oru11
.The text was updated successfully, but these errors were encountered: