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

Glenn Linderman v+python at g.nevcal.com
Sat Mar 29 20:10:23 CET 2014


On 3/29/2014 12:01 PM, Gregory P. Smith wrote:
> From a 2.x-3.x compatible code standpoint the above could exist but 
> the container class constructor would be a no-op on Python 2.
>   if sys.version_info[0] == 2:
>     BytesFormatter = str
>   else:
>     class BytesFormatter: ... def __mod__ ...

If done as a container class, the Python 2 version should implement the 
same restrictions on %s for numerics, and implement %b.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20140329/0ca97ae3/attachment.html>


More information about the Python-Dev mailing list