Commit d4e89287 authored by Mariatta's avatar Mariatta Committed by GitHub

bpo-28739: Document that f-strings cannot be used as docstring (GH-592)

parent 50da40fd
......@@ -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.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment