summaryrefslogtreecommitdiffstats
path: root/Doc/reference
diff options
context:
space:
mode:
authorMariatta <Mariatta@users.noreply.github.com>2017-03-10 17:52:03 (GMT)
committerGitHub <noreply@github.com>2017-03-10 17:52:03 (GMT)
commitff6f3716279e75b2519133a82b9de0c3601963d9 (patch)
treee8e10dc2f50e356ecac280ec21fb337857e7cd25 /Doc/reference
parentfaaa80fb9887950e7068a9506e3517bcd6562ac2 (diff)
downloadcpython-ff6f3716279e75b2519133a82b9de0c3601963d9.zip
cpython-ff6f3716279e75b2519133a82b9de0c3601963d9.tar.gz
cpython-ff6f3716279e75b2519133a82b9de0c3601963d9.tar.bz2
bpo-28739: Document that f-strings cannot be used as docstring (GH-592) (GH-600)
(cherry picked from commit d4e89287b397c7382c12d3f3d9fd901fd8243b3c)
Diffstat (limited to 'Doc/reference')
-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.