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

2021年9月10日 23:24:58 -0700

On 9/9/21 12:04 PM, Terry Reedy wrote:
> Except that .to_bytes already exists, and arguably should have had such 
defaults from the
> beginning, making any new function to do the same thing superfluous.
New functions aren't always about new functionality; sometimes they are about 
increased usability.
Everything in the PEP can already be accomplished, just not easily:
bstr = b'hello world'
bchr = bstr.getbyte(7) # proposed
bchr = bstr[7:8] # existing
for bchr in bstr.iterbytes(): # proposed
 ...
for num in bstr: # existing
 bchr = bytes([bchr])
bchr = bytes.fromint(65) # proposed
bchr = bytes([65]) # existing
--
~Ethan~
_______________________________________________
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/VRZOW3CKHC25I43EIFZO7ZOEOHYBZFNX/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to