This file contains hidden or 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 Set(object): | |
| """Sets can contain anything, including themselves. This leads to | |
| paradoxical behavior: given R, the set of all sets that don't contain | |
| themselves, does R contain R? Here this becomes an infinite recursion. | |
| """ | |
| def __init__(self, predicate): | |
| self.predicate = predicate | |
| def __contains__(self, obj): | |
| return self.predicate(obj) |