[Python-Dev] Re: PEP 467: Minor bytes and bytearray improvements

2021年11月09日 04:46:56 -0800

On Mon, Nov 8, 2021 at 8:21 PM Ethan Furman <[email protected]> wrote:
> The difference with the built-in ascii is the absence of extra quotes and the 
> `b` indicator when a string is used:
>
> ```
> >>> u_var = u'abc'
> >>> bytes.ascii(u_var)
> b'abc'
What about bytes, bytearray and memoryview? What is the expected behavior?
I expect that memoryview is not supported (return something like
b'<memory at 0x7fca8602c700>'), and that bytes and bytearray are
copied without adding "b" prefix or quotes.
bytes.ascii(b'abc') == b'abc'
bytes.ascii(bytearray(b'abc')) == b'abc'
I just suggest to elaborate the specification in the PEP.
Victor
-- 
Night gathers, and now my watch begins. It shall not end until my death.
_______________________________________________
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/3HJQPZB6QWM7IDPDU3KJ4FVY4ESJHQOK/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to