[Python-Dev] PEP 461: Adding % formatting to bytes and bytearray -- Final, Take 2

Antoine Pitrou solipsis at pitrou.net
Mon Feb 24 23:40:45 CET 2014

On Tue, 25 Feb 2014 08:33:53 +1000
Nick Coghlan <ncoghlan at gmail.com> wrote:
> As far as use cases go, as someone else mentioned, the main one is likely
> to be binary logging and error reporting formats, as it becomes a quick and
> easy way to embed a backslash escaped string.

That's a fringe use case, though. Also, your binary logging format
probably has a well-defined character set that's not necessarily ASCII
(perhaps UTF-8), so using the proposed "%a" is sub-optimal and
potentially confusing (if lots of non-ASCII characters get escaped as

> However, my interest is more
> in providing an obvious way to do it and in minimising the differences
> between text and binary interpolation.

That sounds very theoretical.



More information about the Python-Dev mailing list