[Bf-committers] hello, world... :)

dr. Sybren A. Stüvel sybren at stuvel.eu
Tue Feb 12 11:57:51 CET 2019


On 08-02-19 02:23, Benjamin Humpherys wrote:
> Bonus points if you use type annotations in your docstrings. A lot of existing Python code was initially written before PEP484 and so the docstring type annotations are often incompatible with standard Python type checking. 

My preference would be to not use docstring type annotations, but
actually use type hints as described in PEP 484
<https://www.python.org/dev/peps/pep-0484> and PEP 526
<https://www.python.org/dev/peps/pep-0526>. That way it's actually
executed Python code so mistakes are caught sooner, and there aren't
already multiple ways of doing the same thing. Furthermore, it allows
static type checking with mypy <https://mypy.org/>. I'm actively using
mypy in other Blender Institute Python projects and it helps
considerably in catching mistakes early.

-- 
Sybren A. Stüvel

https://stuvelfoto.nl/
https://stuvel.eu/



More information about the Bf-committers mailing list