Hacker News new | past | comments | ask | show | jobs | submit login

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/




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: