3 ms·
reduce() is just moved to a library instead of being a builtin, it's not really a big deal. And of course sum() is better, addition is just the typical example
by andreasvc 14y ago
reduce() is just moved to a library instead of being a builtin, it's not really a big deal. And of course sum() is better, addition is just the typical example for exposition (he later notes that shorter forms are always better). Whether it's good form to stop using it only depends on whether you prefer more explicit for-loops.
- haldean 14y agoYup. Just pointing out that "idiomatic Python" is to prefer sum() to reduce().