Find out if all values in a sequence are equal.
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 eq(*vals): | |
""" | |
Finds out if a bunch of values are equal to each other. | |
""" | |
if len(vals) == 0: | |
return False | |
else: | |
return reduce(lambda x, y: x if x == y else not x, vals) == vals[0] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment