3 ms·
They're not mutually exclusive. Static type checking is fine if you can cover all your code with it, but it doesn't enforce anything at runtime. If you're writi
by rcthompson 9y ago
They're not mutually exclusive. Static type checking is fine if you can cover all your code with it, but it doesn't enforce anything at runtime. If you're writing a library that will be called by other people's code (which likely won't be statically type-checked), it might still be useful to validate your functions' inputs at runtime.
- StavrosK 9y agoTrue, and I guess it helps for when your non-validated code calls validated code. Odd how we've come around to realizing the importance of types and contracts after years of dynamic typing. It's a bit like document databases, people are starting to realize again how convenient relational databases and how helpful schemas are.
- rcthompson 9y agoTo be a little more clear, in a language where static typing was mandatory, there would obviously be no need for dynamic type checking of those same types. But since Python's static typing is optional, dynamic type checking at runtime is not redundant.