summaryrefslogtreecommitdiffstats
path: root/Doc/tutorial
diff options
context:
space:
mode:
authorMartin Panter <vadmium+py@gmail.com>2016-02-13 00:41:37 (GMT)
committerMartin Panter <vadmium+py@gmail.com>2016-02-13 00:41:37 (GMT)
commitbc1ee460dcbe5811ebb10a6cacd8d3670846f039 (patch)
tree1ce59d900fa4173482085eeca44bfe864336534a /Doc/tutorial
parente0b23095ee03a11d09f38cbc689307dc5c93afda (diff)
downloadcpython-bc1ee460dcbe5811ebb10a6cacd8d3670846f039.zip
cpython-bc1ee460dcbe5811ebb10a6cacd8d3670846f039.tar.gz
cpython-bc1ee460dcbe5811ebb10a6cacd8d3670846f039.tar.bz2
Issue #25179: Documentation for formatted string literals aka f-strings
Some of the inspiration and wording is taken from the text of PEP 498 by Eric V. Smith, and the existing str.format() documentation.
Diffstat (limited to 'Doc/tutorial')
-rw-r--r--Doc/tutorial/inputoutput.rst3
-rw-r--r--Doc/tutorial/introduction.rst3
2 files changed, 5 insertions, 1 deletions
diff --git a/Doc/tutorial/inputoutput.rst b/Doc/tutorial/inputoutput.rst
index 5314fed..f2171f4 100644
--- a/Doc/tutorial/inputoutput.rst
+++ b/Doc/tutorial/inputoutput.rst
@@ -25,7 +25,8 @@ first way is to do all the string handling yourself; using string slicing and
concatenation operations you can create any layout you can imagine. The
string type has some methods that perform useful operations for padding
strings to a given column width; these will be discussed shortly. The second
-way is to use the :meth:`str.format` method.
+way is to use :ref:`formatted string literals <f-strings>`, or the
+:meth:`str.format` method.
The :mod:`string` module contains a :class:`~string.Template` class which offers
yet another way to substitute values into strings.
diff --git a/Doc/tutorial/introduction.rst b/Doc/tutorial/introduction.rst
index 8758f38..87f0fa5 100644
--- a/Doc/tutorial/introduction.rst
+++ b/Doc/tutorial/introduction.rst
@@ -352,6 +352,9 @@ The built-in function :func:`len` returns the length of a string::
Strings support a large number of methods for
basic transformations and searching.
+ :ref:`f-strings`
+ String literals that have embedded expressions.
+
:ref:`formatstrings`
Information about string formatting with :meth:`str.format`.