3 ms·
Moving reduce into functools was more than justified: almost nobody liked it, most people disliked it and if you really want to use if for whatever reason an im
by Veedrac 11y ago
Moving reduce into functools was more than justified: almost nobody liked it, most people disliked it and if you really want to use if for whatever reason an import is hardly difficult. The decision was made because of the context, not in disregard to it.
- lmm 11y agoWho disliked it? I used it all the time. Was there any survey or similar?
- Vaskivo 11y agoGuido disliked it. And he's the BDFL.
- Veedrac 11y agoThat's not quite a fair reduction; if it was just down to Guido map would be displaced too, or even gone.
- spiralx 11y agoYou could quite easily use a process like the one described in the article to select the 'top' 1,000 Python packages, and then scan each of those for occurrences of calls to each of map, filter and reduce, and that way build up a fairly reasonable picture of how commonly each function is used. While I use reduce a lot, I would guess that even with comprehensions making most uses of map and filter obsolete, that reduce is still the least commonly called of the three.
- pcote 11y agoThe move of reduce to functools makes sense. But it's also inconsistent. map and filter should also be in the functools package tools right alongside partial and reduce. But instead, they're in __builtins__ because .... they're more popular I guess?
- deadowl 11y agoI'd actually be OK if map and filter were also in the functools package, but the only way to be consistent while maintaining backwards compatibility is going from the functools package to built-in.