18 Jan
2022
18 Jan
'22
7:10 p.m.
Guido van Rossum wrote:
I personally think F-strings should not be usable as docstrings. If you want a dynamically calculated docstring you should assign it dynamically, not smuggle it in using a string-like expression. We don't allow "blah {x} blah".format(x=1) as a docstring either, not "foo %s bar" % x.
Nor, last I checked, even "string1" + "string2", even though the result is a compile-time string in the appropriate location. I think all of these should be allowed, but I'll grant that annotations reduce the need. I'll even admit that scoping issues make the interpolating versions error prone, and the UI to clear that up may be more of a hassle than it is worth. -jJ