Dans python 3.0 reduce() a disparu au profit des boucles explicites.
J'utilise reduce dans python 2.6 pour ce genre de choses :
l = [["a", "b", "c"], ["d", "e", "f"], ["g", "h", "i"]]
reduce (list.__add__, l) -> ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i']
Comment faire dans python 3.0 d'une manière élégante ?
Partager