A Universe Set

Robert Kern robert.kern at gmail.com
Wed Oct 4 06:13:08 CEST 2006

jordan.nick at gmail.com wrote:
> Has the addition of a Universe Set object ever been suggested.  Like U
> = set(0), so that any object was a member of U?

In [61]: class UniverseSet(object):
    ....:         def __contains__(self, x):
    ....:             return True

In [62]: U = UniverseSet()

In [63]: 1 in U
Out[63]: True

In [64]: 2 in U
Out[64]: True

In [65]: 'something' in U
Out[65]: True

In [66]: U in U
Out[66]: True

Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
  that is made terrible by our own mad attempt to interpret it as though it had
  an underlying truth."
   -- Umberto Eco

More information about the Python-list mailing list