Logo

Programming-Idioms

History of Idiom 57 > diff from v47 to v48

Edit summary for version 48 by sgdpk:
[Python] Added comment

Version 47

2019-09-27, 03:28:06

Version 48

2019-09-27, 03:31:27

Idiom #57 Filter list

Create list y containing items from list x satisfying predicate p. Respect original ordering. Don't modify x in-place.

Idiom #57 Filter list

Create list y containing items from list x satisfying predicate p. Respect original ordering. Don't modify x in-place.

Code
y = filter(p, x) 
Code
y = filter(p, x) 
Comments bubble
In Python 3, returns filter object, not a list, following a lazy evaluation approach.