Skip to content
Permalink
Browse files

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

… (GH-600)

(cherry picked from commit d4e8928)
  • Loading branch information...
Mariatta committed Mar 10, 2017
1 parent faaa80f commit ff6f3716279e75b2519133a82b9de0c3601963d9
Showing with 11 additions and 0 deletions.
  1. +11 −0 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.

0 comments on commit ff6f371

Please sign in to comment.
You can’t perform that action at this time.