Last active
August 29, 2015 14:19
-
-
Save mirekfranc/bcbac0d62e8c5833b57a to your computer and use it in GitHub Desktop.
Reducing collection of predicates to a single predicate
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 all_p (ps): | |
def __predicate (*args, **kwargs): | |
return all (p(*args, **kwargs) for p in ps) | |
return __predicate | |
def any_p (ps): | |
def __predicate (*args, **kwargs): | |
return any (p(*args, **kwargs) for p in ps) | |
return __predicate |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment