Skip to content

Instantly share code, notes, and snippets.

@note35
note35 / naive_sets.py
Created July 2, 2018 12:39
russell's paradox in python
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)