Logo

Programming-Idioms

History of Idiom 189 > diff from v2 to v3

Edit summary for version 3 by programming-idioms.org:
[Python] Result named y, for clarity

Version 2

2019-09-27, 13:06:55

Version 3

2019-09-27, 13:07:21

Idiom #189 Filter and transform list

Produce a new list y containing the result of function T applied to all elements of list x that match the predicate P.

Idiom #189 Filter and transform list

Produce a new list y containing the result of function T applied to all elements of list x that match the predicate P.

Extra Keywords
map apply
Extra Keywords
map apply
Code
x = [T(i) for i in x if P(i,x)]
Code
y = [T(i) for i in x if P(i,x)]