[Python-Dev] PEP 461 Final?

Neil Schemenauer nas at arctrix.com
Fri Jan 17 20:51:44 CET 2014


Mark Lawrence <breamoreboy at yahoo.co.uk> wrote:
> Using %b could cause problems in the future as b is used in new style 
> formatting to mean output numbers in binary, so %B seems to me the 
> obvious choice as it's also unused.

After updating my patch, I've decided that %s works better.  My
patch implements PEP 461 as proposed with the following additional
features:

- add %a format code, calls PyObject_ASCII on the argument.  I
  see no reason not too add it as a useful debugging feature.

- add -2 command-line option.  When enabled: %s will fallback
  to calling PyObject_Str() after first trying the buffer API
  and __bytes__.  The value will be encoded using strict ASCII
  encoding.  Also, %r is enabled as an alias for %a.

The patch is v4, bugs.python.org/issue20284, still needs more review
and testing.

  Neil



More information about the Python-Dev mailing list