A Universe Set

Steve Holden steve at holdenweb.com
Wed Oct 4 00:16:01 EDT 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?  Maybe this gets into
> some crazy Cantorian stuff since U is in U.  But it seems like it would
> be useful and would have a nice symmetry with emptyset:set([]), that
> is:
> 
> for any object a:
> "a in set([])" returns False
> "a in set(0)" returns True
> 

  >>> class universe(object):
  ...   def __contains__(self, thing):
  ...     return True
  ...
  >>> U = universe()
  >>> 1 in U
True
  >>> None in U
True
  >>> U in U
True
  >>>

Of course the last eexample shows that your implementation may need to 
change depending on how you view Russell's paradox ...

regards
  Steve
-- 
Steve Holden       +44 150 684 7255  +1 800 494 3119
Holden Web LLC/Ltd          http://www.holdenweb.com
Skype: holdenweb       http://holdenweb.blogspot.com
Recent Ramblings     http://del.icio.us/steve.holden




More information about the Python-list mailing list