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

Nick Coghlan ncoghlan at gmail.com
Wed Feb 26 06:00:34 CET 2014

On 26 February 2014 13:57, Stephen J. Turnbull <stephen at xemacs.org> wrote:
> Nick Coghlan writes that b'%a' is
>  > the obvious way to interpolate representations of arbitrary objects
>  > into binary formats that contain ASCII compatible segments.
> The only argument that I have sympathy for is
>  > %a *should* be allowed for consistency with text interpolation
> although introduction of a new format character is a poor man's
> consistency, and this is consistency for consistency's sake.  (I don't
> have a big problem with that, though.  I *like* consistency!)

It's *not* a new format character, unless you mean "new in Python 3".
Python 3 text interpolation has included %a for as long as I can
recall, specifically as a way of spelling the old Python 2 %r
interpolation behaviour now that the Python 3 %r allows Unicode text.


Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia

More information about the Python-Dev mailing list