[Python-ideas] Fast sum() for non-numbers
Stephen J. Turnbull
stephen at xemacs.org
Tue Jul 9 08:23:13 CEST 2013
Andrew Barnert writes:
> Meanwhile sum is the obvious way to sum things that are obviously
> summable (numbers, matrices, etc.), and nothing else.
My intuition matches yours, but I find this argument (and the rest of
the arguments that say that "generic sum() is unobvious and wrong")
logically unsatisfactory. It would be nice if you could provide a
plausible definition of "summable" other than "__add__() is
implemented". I don't have one. :-(
More information about the Python-ideas
mailing list