[Python-Dev] Re: PEP 467 feedback from the Steering Council

2021年9月08日 10:10:51 -0700

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
_______________________________________________
Python-Dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/[email protected]/message/FMG5K4BOX5GSUR2KU3G5ZLBBUIC3EQKD/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to