[Python-Dev] PEP 460: allowing %d and %f and mojibake (original) (raw)

Glenn Linderman v+python at g.nevcal.com
Sun Jan 12 22:59:37 CET 2014


On 1/12/2014 11:14 AM, Ethan Furman wrote:

And a core principle of the bytes/text separation in Python 3 is that encoding should never happen implicitly. That could be. And yet the bytes type already has several concessions to ASCII encoding.

"%d" % 26 => an explicit request to convert binary integer to a base-10 Unicode/text representation of the integer

b"%d" % 26 => an explicit request to convert binary integer to a base-10 ASCII bytes representation of the integer

The leading "b" seems to be a very explicit request for bytes rather than characters to me, and seems much more attractive than the proposals to embed binary in Unicode by abusing Latin-1 encoding. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-dev/attachments/20140112/f754ff82/attachment-0001.html>



More information about the Python-Dev mailing list