summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2008-05-11 09:06:30 (GMT)
committerGeorg Brandl <georg@python.org>2008-05-11 09:06:30 (GMT)
commit53905d8f7fbca1e6291daaa8dedc3e4278d37d4a (patch)
treef1300d4dff36019735814c3ccc55b2b2e863ed1e
parent25ad76c91d9add168369360cb33953070a4c16a1 (diff)
downloadcpython-53905d8f7fbca1e6291daaa8dedc3e4278d37d4a.zip
cpython-53905d8f7fbca1e6291daaa8dedc3e4278d37d4a.tar.gz
cpython-53905d8f7fbca1e6291daaa8dedc3e4278d37d4a.tar.bz2
#1153769: document PEP 237 changes to string formatting.
-rw-r--r--Doc/library/stdtypes.rst13
1 files changed, 8 insertions, 5 deletions
diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst
index 52b1c8b..5894957 100644
--- a/Doc/library/stdtypes.rst
+++ b/Doc/library/stdtypes.rst
@@ -1185,7 +1185,7 @@ The conversion flag characters are:
+---------+---------------------------------------------------------------------+
A length modifier (``h``, ``l``, or ``L``) may be present, but is ignored as it
-is not necessary for Python.
+is not necessary for Python -- so e.g. ``%ld`` is identical to ``%d``.
The conversion types are:
@@ -1196,13 +1196,13 @@ The conversion types are:
+------------+-----------------------------------------------------+-------+
| ``'i'`` | Signed integer decimal. | |
+------------+-----------------------------------------------------+-------+
-| ``'o'`` | Unsigned octal. | \(1) |
+| ``'o'`` | Signed octal value. | \(1) |
+------------+-----------------------------------------------------+-------+
-| ``'u'`` | Unsigned decimal. | |
+| ``'u'`` | Obselete type -- it is identical to ``'d'``. | \(7) |
+------------+-----------------------------------------------------+-------+
-| ``'x'`` | Unsigned hexadecimal (lowercase). | \(2) |
+| ``'x'`` | Signed hexadecimal (lowercase). | \(2) |
+------------+-----------------------------------------------------+-------+
-| ``'X'`` | Unsigned hexadecimal (uppercase). | \(2) |
+| ``'X'`` | Signed hexadecimal (uppercase). | \(2) |
+------------+-----------------------------------------------------+-------+
| ``'e'`` | Floating point exponential format (lowercase). | \(3) |
+------------+-----------------------------------------------------+-------+
@@ -1271,6 +1271,9 @@ Notes:
The precision determines the maximal number of characters used.
+(7)
+ See :pep:`237`.
+
Since Python strings have an explicit length, ``%s`` conversions do not assume
that ``'\0'`` is the end of the string.