4 ms·
The word you are looking for is structural typing. (as opposed to nominal typing) It's essentially type-safe duck typing. In the case of square, you say i want
by Too 6y ago
The word you are looking for is structural typing. (as opposed to nominal typing)
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/ https://www.python.org/dev/peps/pep-0544/