I can't believe it...
20 years of #Python in my fingers and I discover that the “right” way to put a docstring to a variable is “after” the variable.
Why is that? Because Python uses interpretable strings and therefore the variable takes precedence. Just as you'd put a docstring after a function or class declaration, you have to do the same in Python. And that's what makes mkdocstrings-python work!
It's not at all intuitive, but in the long run it's much easier to read!
@metal3d nearly 20 years of python here, and you just taught me that, heh, so thank you.
@tshirtman @metal3d To be fair, back when we started, that wasn't a thing for quite a few years to come.
Now let's move on to all the reasons given in PEP 258 (rejected elsewhere).
https://peps.python.org/pep-0258/
The reasons given are very logical - but so are the reasons for rejection. The thing is, since I've switched to this way of documenting my code, I find it obvious and clever.
The fact that the code editor (neovim) and mkdocstrings follow this logic reinforces my belief that we should all do things this way.
But what do you think?