Created
February 16, 2015 13:58
-
-
Save stain/0e068a49260c9a3458c8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>>> def negate(f): | |
... return lambda *args,**kwargs: not f(*args, **kwargs) | |
... | |
>>> a = ["hello", "Hello there", "My name is"] | |
>>> def contains_space(s): | |
... return " " in s | |
... | |
>>> list(filter(contains_space, a)) | |
['Hello there', 'My name is'] | |
>>> list(filter(negate(contains_space), a)) | |
['hello'] | |
>>> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment