Last active
December 26, 2016 08:52
-
-
Save hombit/22f14a444bca09ce8aca13ec0024842c 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
class ContainsEverythingExceptNone: | |
def __contains__(self, item): | |
return item is not None | |
c = ContainsEverythingExceptNone() | |
assert 57 in c | |
assert not None in c |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment