add section on Python 2 compatibility

This commit is contained in:
Ethan Furman 2014-03-27 12:46:04 -07:00
parent 38d958603b
commit 881b096a56
1 changed files with 14 additions and 0 deletions

View File

@ -159,6 +159,20 @@ Unsupported codes
``%r`` (which calls ``__repr__`` and returns a ``str``) is not supported.
Compatibility with Python 2
===========================
As noted above, ``%s`` is being included solely to help ease migration from,
and/or have a single code base with, Python 2. This is important as there
are modules both in the wild and behind closed doors that currently use the
Python 2 ``str`` type as a ``bytes`` container, and hence are using ``%s``
as a bytes interpolator.
However, ``%b`` should be used in new, Python 3 only code, so ``%s`` will
immediately be deprecated, but not removed until the next major Python
release.
Proposed variations
===================