Ronald Oussoren added the comment:
There's an annoyingly long discussion about sum() on python-ideas.
IMHO the documentation should mention, as it does now, that sum is intended to
be used with a sequence of numbers even it does work with most objects that
support the + operator (such as by implementing __add__). In particular, using
sum with a sequence of lists or tuples is extremely inefficient.
The fact that sum({1:'a', 2: 'b'}) works is a side effect of the how python
works with sequences and IMHO doesn't have to be documented in every function
that accepts a sequence as an argument.
----------
nosy: +ronaldoussoren
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue18424>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com