I would love
small_evens = set([2, 4, 6, 8])
only_small_odds = filter(not in small_evens, [1, 3, 4, 1, 1, 2, 7, 6, 4, 5])
but of course this is a syntax error.
both filter(lambda x: x not in set, items)
and [x for x in items if x not in set]
feel too verbose.
Is there another way?
I suspect there might be because, for example, newer Python versions have made map(str.lower, strings)
possible (used to have to map(lambda s: s.lower(), strings)
)