summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMariatta <Mariatta@users.noreply.github.com>2017-03-10 16:58:40 (GMT)
committerGitHub <noreply@github.com>2017-03-10 16:58:40 (GMT)
commitd4e89287b397c7382c12d3f3d9fd901fd8243b3c (patch)
tree1ffb426ff97a9b1be3bd432b38b6540c12860ed7
parent50da40fd5295c8ca75f7bbdc1009714680e99ac0 (diff)
downloadcpython-d4e89287b397c7382c12d3f3d9fd901fd8243b3c.zip
cpython-d4e89287b397c7382c12d3f3d9fd901fd8243b3c.tar.gz
cpython-d4e89287b397c7382c12d3f3d9fd901fd8243b3c.tar.bz2
bpo-28739: Document that f-strings cannot be used as docstring (GH-592)
-rw-r--r--Doc/reference/lexical_analysis.rst11
1 files changed, 11 insertions, 0 deletions
diff --git a/Doc/reference/lexical_analysis.rst b/Doc/reference/lexical_analysis.rst
index da7017a..7f9c664 100644
--- a/Doc/reference/lexical_analysis.rst
+++ b/Doc/reference/lexical_analysis.rst
@@ -696,6 +696,17 @@ a temporary variable.
>>> f"newline: {newline}"
'newline: 10'
+Formatted string literals cannot be used as docstrings, even if they do not
+include expressions.
+
+::
+
+ >>> def foo():
+ ... f"Not a docstring"
+ ...
+ >>> foo.__doc__ is None
+ True
+
See also :pep:`498` for the proposal that added formatted string literals,
and :meth:`str.format`, which uses a related format string mechanism.