Is there a reason this implementation was chosen? #307
Answered
by
jlaine
M15terHyde
asked this question in
Q&A
-
Line 1223 in 7b3f24b I understand it's shifting each byte onto the right to recreate the integer of the message_length but why reinvent the wheel when python integers already have int.from_bytes. Was there a reason:
was not chosen? |
Beta Was this translation helpful? Give feedback.
Answered by
jlaine
Jul 17, 2022
Replies: 1 comment
-
Hah good catch, I'm guessing it's just me not knowing the standard library inside out! message_length = 4 + int.from_bytes(buffer[1:4], byteorder="big") Here is a PR which makes use of int.from_bytes and int.to_bytes: |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
jlaine
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hah good catch, I'm guessing it's just me not knowing the standard library inside out!
Here is a PR which makes use of int.from_bytes and int.to_bytes:
#312