[Python-checkins] peps: Added more words about rejecting binary f-strings.
eric.smith
python-checkins at python.org
Fri Aug 21 10:54:20 CEST 2015
https://hg.python.org/peps/rev/def0d4b6bb17
changeset: 5964:def0d4b6bb17
user: Eric V. Smith <eric at trueblade.com>
date: Fri Aug 21 04:54:23 2015 -0400
summary:
Added more words about rejecting binary f-strings.
files:
pep-0498.txt | 16 +++++++++++++++-
1 files changed, 15 insertions(+), 1 deletions(-)
diff --git a/pep-0498.txt b/pep-0498.txt
--- a/pep-0498.txt
+++ b/pep-0498.txt
@@ -459,7 +459,18 @@
object's __format__() method may return Unicode data that is not
compatible with a bytes string.
-#XXX: maybe allow this, but encode the output as ascii?
+Binary f-strings would first require a solution for
+bytes.format(). This idea has been proposed in the past, most recently
+in PEP 461 [#]_. The discussions of such a feature usually suggest either
+
+ - adding a method such as __bformat__() so an object can control how
+ it is converted to bytes, or
+
+ - having bytes.format() not be as general purpose or extensible as
+ str.format().
+
+Both of these remain as options in the future, if such functionality
+is desired.
!s, !r, and !s are redundant
----------------------------
@@ -567,6 +578,9 @@
.. [#] Differences in str.format() and f-string expressions
(https://mail.python.org/pipermail/python-ideas/2015-July/034726.html)
+.. [#] PEP 461 rejects bytes.format(), see section "Proposed variations"
+ (http://legacy.python.org/dev/peps/pep-0461)
+
Copyright
=========
--
Repository URL: https://hg.python.org/peps
More information about the Python-checkins
mailing list