diff options
author | Mariatta <Mariatta@users.noreply.github.com> | 2017-03-10 16:58:40 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-10 16:58:40 (GMT) |
commit | d4e89287b397c7382c12d3f3d9fd901fd8243b3c (patch) | |
tree | 1ffb426ff97a9b1be3bd432b38b6540c12860ed7 /Doc | |
parent | 50da40fd5295c8ca75f7bbdc1009714680e99ac0 (diff) | |
download | cpython-d4e89287b397c7382c12d3f3d9fd901fd8243b3c.zip cpython-d4e89287b397c7382c12d3f3d9fd901fd8243b3c.tar.gz cpython-d4e89287b397c7382c12d3f3d9fd901fd8243b3c.tar.bz2 |
bpo-28739: Document that f-strings cannot be used as docstring (GH-592)
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/reference/lexical_analysis.rst | 11 |
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. |