[Python-ideas] Structural type checking for PEP 484

Sven R. Kunze srkunze at mail.de
Thu Sep 17 23:24:53 CEST 2015

On 17.09.2015 05:59, Steven D'Aprano wrote:
> People will use the same sort of heuristic for deciding which functions
> get annotated:
> - does the function need annotations/documentation/tests?
> - do I have time to write annotations/documentation/tests?
> - is my manager telling me to add annotations/documentation/tests?
> - if I don't, will bad things happen?
> - if it easy or interesting to add them?
> - or difficult and boring?

I fear I am not convinced of that analogy.

Tests and documentation is all or nothing. Either you have them or you 
don't and one is not worthier than another.

Type annotations (as far as I understand them) are basically completing 
a picture of 40%-of-already-inferred types. So, I have difficulties to 
infer which parameters actually would benefit from annotating. I am 
either doing redundant work (because the typechecker is already very 
well aware of the type) or I actually insert explicit knowledge (which 
might become redundant in case typecheckers actually become better).

More information about the Python-ideas mailing list