On Thu, 13 Jan 2022 at 02:31, Steven Barker <blckkn...@gmail.com> wrote: > > While f-strings in class scope could theoretically be valid docstrings a lot > of the time, the equivalent situation for function docstrings is much less > positive. A function like this the one below obviously problematic, since the > f-string value is not a compile-time constant: > > def foo(x): f"is this a docstring? x is {x}" > > I'm pretty sure f-strings cannot be used as docstrings in other contexts > because of how broken they'd be in functions. >
I don't have a horse in the race of whether this should be allowed or not for constant f-strings. I do however believe that having something like the example given previously where the code doesn't do what it appears to do, by silently not setting the docstring without giving a warning, is bad behaviour. -- Neil Muller drnlmul...@gmail.com _______________________________________________ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-le...@python.org https://mail.python.org/mailman3/lists/python-dev.python.org/ Message archived at https://mail.python.org/archives/list/python-dev@python.org/message/Y3AVDHPBVEEJERIG2P326XHR5FT6UAH5/ Code of Conduct: http://python.org/psf/codeofconduct/