News for hackers. Stuff that matters.
Re:Static types in Python by zardeh on Thursday October 13, 2016 @09:05PM (#12705492)
Well yes, but

    # optionally: Number = Union[int, float, complex]
    def sum_and_stringify(nums: Iterable[Number]) -> str:
        return str(sum(nums))
also works. Except no one knows what the Number abstract base class is (or even the Iterable abstract base class for that matter)
Re:Static types in Python by clusmore on Thursday October 13, 2016 @09:13PM (#12705528)
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__).
Re:Static types in Python by zardeh on Friday October 14, 2016 @05:23AM (#12706952)
Well, my joke was that numbers.Number exists, and I think supports those operations, but even someone complaining about this topic is unaware that it exists.