TIL that Python docstrings cannot be F-strings. Th...
# development
h
TIL that Python docstrings cannot be F-strings. The
__doc__
will be set to
None
🤯 4
cc @ancient-vegetable-10556, I think I picked this pattern up from you
a
which pattern?
using f-strings as docstrings?
b
Do you have an example? I swear I've seen f-docstrings
c
it is..
I have one in my draft BUILD file symbols pr
need to rework that one
a
Yeah, even an f-string without any placeholders
a
fwiw, you can set docstrings after the fact if you really want f-strings 😄
1
c
yep, was thinking to add a
docstring
decorator..
h
yeah, we have several instances of using f-strings in docstring. But apparently they're all wrong https://stackoverflow.com/questions/70863543/can-a-python-docstring-be-calculated-f-string-or-expression
a
@curved-television-6568 with a
@docstring
decorator, you probably can’t refer to classvars inside the item you’re decorating, because the params to the decorator get evalled before the class body
(

decorators are a mindfuck

)
c
for my use-case, that’s ok.