[issue11011] More functools functions
Raymond Hettinger
report at bugs.python.org
Wed Jan 26 00:08:03 CET 2011
Raymond Hettinger <rhettinger at users.sourceforge.net> added the comment:
One other thought: The use of list comprehensions (a.k.a. list displays) and generator expressions has made many functional tools less necessary than ever.
# preferred over map(pow, repeat(2), range(5))
[pow(2, x) for x in range(5)]
# preferred over map(flip, dict.items())
[(v, k) for k, v in mydict.items()]
The list comprehension and genexp styles are much more flexible and works well with default arguments, constants, and using a combination of features:
# hard to do with functionals
[f(g(2,x), h(x, 3, y, flag=True)) for x, y in zip(X, Y) if x>y//2]
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue11011>
_______________________________________
More information about the Python-bugs-list
mailing list