by kortex · 6y ago · 0 comments
It's like duck typing with a built-in Audubon society taxonomy chart.
You can always do whatever you want at runtime, it's still python.
IMHO, duck typing is strictly inferior to interface typing. You'd define a `Number` interface which `int`, `float`, ect all implement.
Duck typing has been fundamental to Python for a long time. Do you think we're seeing a shift away from it? In the future, do you think "Pythonic" code will include significant use of explicit interfaces?
We have been since at least the introduction of abstract base classes; even in purely dynamic python, having the ability to more explicitly declare and interrogate intent than pure duck typing is frequently useful.
> do you think "Pythonic" code will include significant use of explicit interfaces?
Sure, as it already does via abcs. But it will also still use lots of duck typing, though over time more of it will be “static duck typing” by way of protocols.
But of course give the slightest whiff of types and the type police will come and want to shove types down your throat all the way