Terry J. Reedy added the comment:

Much of this discussion seems to duplicate and effectively re-open of #25179, 
wherein it was decided/accepted that true, non-degenerate, non-trivial, 
non-constant, f-strings that actually do formatting are not constants and do 
not and should not become docstrings.  I agree.  I think this issue should 
either be closed as 'not a bug' or redefined as a doc issue.

It was noted by Martin P. in #25179 that "a constant f-string without any 
interpolations does become a doc string."  That is because such is really a 
string literal and not really an f-string, in the same sense that 'circle of 
radius 0' is really a point and not a circle.

The current glossary entry is

"docstring
    A string literal which appears as the first expression in a class, function 
or module. While ignored when the suite is executed, it is recognized by the 
compiler and put into the __doc__ attribute of the enclosing class, function or 
module. Since it is available via introspection, it is the canonical place for 
documentation of the object."

I suggest adding "Bytestring literals and non-trivial f-strings do not become 
docstrings." as the second sentence.

----------
nosy: +terry.reedy

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue28739>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to