
Sept. 8, 2021
5:06 p.m.
Steven D'Aprano wrote:
To me, it sounds like should be the opposite of int.from_bytes.
int.from_bytes(b'Hello world', 'little') 121404708502361365413651784 >>> bytes.from_int(121404708502361365413651784, 'little') # should return b'Hello world' If that's not the API being suggested, that's going to be confusing.
I'm a bit lost here... why are we convinced at all that we need a new way to do this? Hasn't this functionality already existed for years?
x = int.from_bytes(b"*", "little") x 42 x.to_bytes(1, "little") b'*'
Brandt