[Python-checkins] peps: add section on Python 2 compatibility
ethan.furman
python-checkins at python.org
Thu Mar 27 20:46:14 CET 2014
http://hg.python.org/peps/rev/b913b974028e
changeset: 5440:b913b974028e
user: Ethan Furman <ethan at stoneleaf.us>
date: Thu Mar 27 12:46:04 2014 -0700
summary:
add section on Python 2 compatibility
files:
pep-0461.txt | 14 ++++++++++++++
1 files changed, 14 insertions(+), 0 deletions(-)
diff --git a/pep-0461.txt b/pep-0461.txt
--- a/pep-0461.txt
+++ b/pep-0461.txt
@@ -159,6 +159,20 @@
``%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
===================
--
Repository URL: http://hg.python.org/peps
More information about the Python-checkins
mailing list