[Python-Dev] RFC: PEP 460: Add bytes % args and bytes.format(args) to Python 3.5

Ethan Furman ethan at stoneleaf.us
Sat Jan 11 19:09:33 CET 2014


On 01/11/2014 07:34 AM, Nick Coghlan wrote:
> On 12 January 2014 01:15, M.-A. Lemburg wrote:
>>
>> We don't have to be pedantic about the bytes/text separation.
>> It doesn't help in real life.
>
> Yes, it bloody well does. The number of people who have told me that
> using Python 3 is what allowed them to finally understand how Unicode
> works . . .

We are not proposing a change to the unicode string type in any way.


> We are NOT going back to the confusing incoherent mess that is the
> Python 2 model of bolting Unicode onto the side of POSIX . . .

We are not asking for that.


>> bytes already have most of the 8-bit string methods from Python 2,
>> so it doesn't hurt adding some more of the missing features
>> from Python 2 on top to make life easier for people dealing
>> with multiple/unknown encoding data.
>
> Because people that aren't happy with the current bytes type
> persistently refuse to experiment with writing their own extension
> type to figure out what the API should look like. Jamming speculative
> API design into the core text model without experimenting in a third
> party extension first is a straight up stupid idea.

True, if this were a new API; but it isn't, it's the Py2 str API that was stripped out.  The one big difference being 
that if the results of %s (or %d or any other %) is not in the 0-127 range it errors out.

--
~Ethan~


More information about the Python-Dev mailing list