B
Buck Golemon
I feel like the design of sum() is inconsistent with other language
features of python. Often python doesn't require a specific type, only
that the type implement certain methods.
Given a class that implements __add__ why should sum() not be able to
operate on that class?
We can fix this in a backward-compatible way, I believe.
Demonstration:
I'd expect these two error messages to be identical, but they are
not.
TypeError: unsupported operand type(s) for +: 'C' and 'C'
features of python. Often python doesn't require a specific type, only
that the type implement certain methods.
Given a class that implements __add__ why should sum() not be able to
operate on that class?
We can fix this in a backward-compatible way, I believe.
Demonstration:
I'd expect these two error messages to be identical, but they are
not.
TypeError: unsupported operand type(s) for +: 'C' and 'C'