Re:Static types in Python
by zardeh on Thursday October 13, 2016 @09:05PM
(#12705492)
Well yes, but
also works. Except no one knows what the Number abstract base class is (or even the Iterable abstract base class for that matter)
[ Parent
| on HN ]
Yeah but as I said it can still go far more general than just int, float and complex. It could be any arbitrary class defined by somebody else that I could not possibly know about at design time, and so a whitelisting approach of concrete classes is simply not going to cut it. It would be nice to have a way to describe the actual requirements (only that the elements support __add__ and __radd__).