Does anybody know how to document in #Python that the return value of a function is a #Django Queryset? And better if the queryset is of a specific model. #docstring
For a programming language (formerly) overseen by a benevolent dictator for life, #Python is awfully democratic.
Help me learn and decide: Which type of #docstring should I use in my Python code and why?
- Plain
- Epytext
- reStructuredText
- Numpy
- Google?
When #programming, the first thing I write for a new #python #class or #method is the #docstring. (Sorry about all the hashtags, but you did see this.)
Docstrings written this way are expressions of optimism and hope: What it says it does you will soon be able to make it do! It's happened enough times for me to really believe it now. Therein lies a directed, focused burst of creativity.
The alternative: grudging summary of a solution to a problem that might not have been very well defined.
I've been doing some VS Code extension hacking recently (something cool coming soon, possibly!) and I have to say...
It is really a testament to LISP and to the Emacs contributors that docstrings are:
1. a core part of the language
2. are available on nearly every function and command
The best way to even find out if a command _exists_ in VS Code is to open the "keyboard shortcuts" window. And then just guess the args…
Been playing around with the new #treesitter feature in #emacs. Using it to add docstrings to the current function in #python (in the bottom right window) .
#xdoctest: A rewrite of #Python's builtin doctest module (with #pytest plugin integration) but without all the weirdness | #dev #docstring #tests https://github.com/Erotemic/xdoctest
#darglint: A #python documentation linter which checks that the #docstring description matches the definition. | #dev #implementation #match https://github.com/terrencepreilly/darglint