mirror of https://github.com/python/cpython.git
bpo-28739: Document that f-strings cannot be used as docstring (GH-592)
This commit is contained in:
parent
50da40fd52
commit
d4e89287b3
|
@ -696,6 +696,17 @@ a temporary variable.
|
||||||
>>> f"newline: {newline}"
|
>>> f"newline: {newline}"
|
||||||
'newline: 10'
|
'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,
|
See also :pep:`498` for the proposal that added formatted string literals,
|
||||||
and :meth:`str.format`, which uses a related format string mechanism.
|
and :meth:`str.format`, which uses a related format string mechanism.
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue