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

> Edit: I shouldn't have said duck typing but rather the lack of strong/compile checks

Every compiled language I can think of would also be totally happy for you to pass (int width, int height) to a function designed to handle (int x2, int y2) - what language are you thinking of that would make this a compile error?

Some languages do allow you to create your own custom types which mean you can spot the difference between two types of int and avoid mixing them up… but python is one of those languages.




Its a library design rather than a language design thing. You could make a separate class Size and Point that both take an (int, int) constructor, and even have BoundingBox whose constructor takes (Point, Point), and the function could take a BoundingBox instead of a list of tuples. Of course, you can do that in Python, just as well.




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

Search: