Package gavo :: Package utils :: Module codetricks :: Class AllEncompassingSet
[frames] | no frames]

Class AllEncompassingSet

source code

object --+    
         |    
       set --+
             |
            AllEncompassingSet

a set that contains everything.

Ok, so this doesn't exist. Yes, I've read my Russell. You see, this is a restricted hack for a reason. And even the docstring is contradictory.

Sort-of. This now works for intersection and containing. Should this reject union? Also, unfortunately this only works as a left operand; I don't see how to override whatever set does with this as a right operand.

>>> s = AllEncompassingSet()
>>> s & set([1,2])
set([1, 2])
>>> "gooble" in s
True
>>> s in s
True
>>> s not in s
False
Instance Methods
new empty set object
__init__(self)
x.__init__(...) initializes x; see help(type(x)) for signature
source code
 
__nonzero__(self) source code
 
__and__(self, other)
x&y
source code
 
intersection(self, other)
x&y
source code
 
__contains__(self, el)
y in x.
source code

Inherited from set: __cmp__, __eq__, __ge__, __getattribute__, __gt__, __iand__, __ior__, __isub__, __iter__, __ixor__, __le__, __len__, __lt__, __ne__, __new__, __or__, __rand__, __reduce__, __repr__, __ror__, __rsub__, __rxor__, __sizeof__, __sub__, __xor__, add, clear, copy, difference, difference_update, discard, intersection_update, isdisjoint, issubset, issuperset, pop, remove, symmetric_difference, symmetric_difference_update, union, update

Inherited from object: __delattr__, __format__, __reduce_ex__, __setattr__, __str__, __subclasshook__

Class Variables

Inherited from set: __hash__

Properties

Inherited from object: __class__

Method Details

__init__(self)
(Constructor)

source code 

x.__init__(...) initializes x; see help(type(x)) for signature

Returns: new empty set object
Overrides: object.__init__
(inherited documentation)

__and__(self, other)
(And operator)

source code 

x&y

Overrides: set.__and__
(inherited documentation)

intersection(self, other)

source code 

x&y

Overrides: set.intersection
(inherited documentation)

__contains__(self, el)
(In operator)

source code 

y in x.

Overrides: set.__contains__
(inherited documentation)