Actually, if we want to be super strict, filter, map and lambda are few of those things that aren't considered really Pythonic. Guido van Rossum wanted to remove all of them in Python 3, but then backtracked and only removed reduce. See The fate of reduce() in Python 3000 (dated 2005!!).
A more "pythonic" way to write that would be:
[wforwinwordsiflen(w)==max(len(x)forxinwords)]
or with a generation expression to avoid consuming all items eagerly:
(wforwinwordsiflen(w)==max(len(x)forxinwords))
or with a set comprehension to remove duplicates automatically
Actually, if we want to be super strict,
filter
,map
andlambda
are few of those things that aren't considered really Pythonic. Guido van Rossum wanted to remove all of them in Python 3, but then backtracked and only removedreduce
. See The fate of reduce() in Python 3000 (dated 2005!!).A more "pythonic" way to write that would be:
or with a generation expression to avoid consuming all items eagerly:
or with a set comprehension to remove duplicates automatically