4 ms·
> The point of duck typing was that you don't have to write all that boilerplate and stuff just works as long as the right functions are there. As long as your
by kortex 4y ago
> The point of duck typing was that you don't have to write all that boilerplate and stuff just works as long as the right functions are there.
As long as your definition of "just works" is "run, crash, fix something, run, repeat". I remember the pre-type-annotation days, and still live it with some libraries. I find it quite unpleasant, but hey I guess some folks like the "freedom".
> So it's very easy to create code that passes the type checker, but fails at runtime or vice versa.
In theory, yes, in practice, not as much as you might think. If you actually use mypy with strict, which is actually really hard to do, you will find very, very few surprises.