It's essentially type-safe duck typing. In the case of square, you say i want x and y to support the multiply-operator, but i don't care what type they are otherwise.
Available since 3.8: https://www.python.org/dev/peps/pep-0544/
It's essentially type-safe duck typing. In the case of square, you say i want x and y to support the multiply-operator, but i don't care what type they are otherwise.
Available since 3.8: https://www.python.org/dev/peps/pep-0544/