Message192811
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. |
|
Date |
User |
Action |
Args |
2013-07-10 14:04:42 | ronaldoussoren | set | recipients:
+ ronaldoussoren, r.david.murray, docs@python, marco.buttu |
2013-07-10 14:04:42 | ronaldoussoren | set | messageid: <1373465082.73.0.180468151718.issue18424@psf.upfronthosting.co.za> |
2013-07-10 14:04:42 | ronaldoussoren | link | issue18424 messages |
2013-07-10 14:04:42 | ronaldoussoren | create | |
|