5 ms·
protocols (think Java interfaces) are becoming a thing for the type checking, so that's what you can use in places like this in the future. something like `Ite
by rtpg 10y ago
protocols (think Java interfaces) are becoming a thing for the type checking, so that's what you can use in places like this in the future. something like `Iterable[Addable]`
- clusmore 10y agoThis is great provided that Addable is not just something hardcoded to know about builtins like int and float. If I create my own class that quacks like an Addable, then it needs to be supported. That's the essence of duck-typing.
- yxhuvud 10y agoI suggest you go and have a long hard look at Crystal. From your comments I am getting the feeling you could appreciate it.
- clusmore 10y agoThanks for the suggestion. For the record, I'm a fairly happy C# for work, Haskell for hobby programmer, using Python as my go-to for quick-and-dirty scripts. My comments here are mostly based on my own thoughts on the static vs dynamic debate, in this case specifically how to keep the advantages of dynamic languages whilst absorbing some of the benefits of static checking. They have nothing to do with the best usage of MyPy in production-grade Python projects, of which I have zero experience.