[issue28739] PEP 498: docstrings as f-strings
Martin Panter
report at bugs.python.org
Fri Nov 18 17:14:12 EST 2016
Martin Panter added the comment:
Actually, testing your code fragment, it seems you do get a doc string when the f-string has no substitutions in curly brackets, otherwise you don’t get any doc string. Maybe this is due to how different forms of string are compiled.
>>> class Foo:
... f'spam' # Compiled as plain 'spam'
...
>>> Foo.__doc__
'spam'
>>> class Foo:
... 'spam' f'{"MMM"}' # Compiled as f'spam{"MMM"}'
...
>>> Foo.__doc__ is None
True
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue28739>
_______________________________________
More information about the Python-bugs-list
mailing list