Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c45a8a1

Browse files
committed
Issue #14123: Explicitly mention that old style % string formatting has caveats but is not going away any time soon.
2 parents ab7bf21 + 3bbdc8e commit c45a8a1

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

Doc/library/stdtypes.rst

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1466,8 +1466,13 @@ Old String Formatting Operations
14661466
14671467
.. note::
14681468

1469-
The formatting operations described here are obsolete and may go away in future
1470-
versions of Python. Use the new :ref:`string-formatting` in new code.
1469+
The formatting operations described here are modelled on C's printf()
1470+
syntax. They only support formatting of certain builtin types. The
1471+
use of a binary operator means that care may be needed in order to
1472+
format tuples and dictionaries correctly. As the new
1473+
:ref:`string-formatting` syntax is more flexible and handles tuples and
1474+
dictionaries naturally, it is recommended for new code. However, there
1475+
are no current plans to deprecate printf-style formatting.
14711476

14721477
String objects have one unique built-in operation: the ``%`` operator (modulo).
14731478
This is also known as the string *formatting* or *interpolation* operator.

0 commit comments

Comments
 (0)