[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 17:20:27 CET 2014


On 01/11/2014 07:38 AM, Steven D'Aprano wrote:
>
> The point that I am making is that many people want to add formatting
> operations to bytes so they can put ASCII strings inside bytes. But (as
> far as I can tell) they don't need to do this, because they can treat
> Unicode strings containing code points U+0000 through U+00FF (i.e. the
> same range as handled by Latin-1) as if they were bytes.

So instead of blurring the line between bytes and text, you're blurring the line between text and bytes (with a few 
extra seat belts thrown in).  Besides being a bit awkward, this also means that any encoded text (even the plain ASCII 
stuff) is now being transformed three times instead of one:

   unicode to bytes
   bytes to unicode using latin1
   unicode to bytes

Even if the cost of moving those bytes around is cheap, it's not free.  When you're creating hundreds of PDFs at a time 
that's going to make a difference.

--
~Ethan~


More information about the Python-Dev mailing list