[Python-ideas] Stop displaying elements of bytes objects as printable ASCII characters in CPython 3

Eric V. Smith eric at trueblade.com
Tue Sep 16 15:02:08 CEST 2014


On 09/15/2014 08:43 PM, Ethan Furman wrote:
> On 09/15/2014 04:47 PM, Nick Coghlan wrote:
>>
>> The current suggestion on the issue tracker is to add __format__ to
>> bytes/bytearray/memoryview with a suitable symbolic mini-language to
>>  control the formatting details.
> 
> PEP 461 specifically did not add back __format__ to bytes/bytearrays.  I
> think a PEP is appropriate to reverse that decision.

That's different. PEP 461 excluded them because it was talking about
bytes.format(). bytes.__format__() would be much easier to deal with,
because its result must be unicode (str in 3.x).

I don't think just adding bytes/bytearray.__format__() per se requires a
PEP. It's not a very radical addition, similar to datetime.__format__().
But I wouldn't be opposed to a PEP to decide on the specifics of the
mini-language that bytes.__format__() supports.

Eric.



More information about the Python-ideas mailing list