Re:Static Duck Typing in Python with Protocols
by formerly_proven on Tuesday November 23, 2021 @05:06AM
(#29316211)
If you have a Rect type that'll likely take four arguments and you can still make the same mistake of confusing the Rect(x, y, w, h) signature with Rect(x1, y1, x2, y2). This of course could not happen if Rect were defined as Rect(Point origin, Size size) but that might get a tad annoying for callers.
[ Parent
| on HN ]
There are no comments on this comment yet.