_abcoll :: Set :: Class Set
[hide private]
[frames] | no frames]

Class Set

object --+    
         |    
     Sized --+
             |
object --+   |
         |   |
  Iterable --+
             |
object --+   |
         |   |
 Container --+
             |
            Set
Known Subclasses:

A set is a finite, iterable container.

This class provides concrete generic implementations of all methods except for __contains__, __iter__ and __len__.

To override the comparisons (presumably for speed, as the semantics are fixed), redefine __le__ and __ge__, then the other operations will automatically follow suit.

Nested Classes [hide private]
    Inherited from Sized
  __metaclass__
Metaclass for defining Abstract Base Classes (ABCs).
Instance Methods [hide private]
 
__and__(self, other)
 
__eq__(self, other)
 
__ge__(self, other)
 
__gt__(self, other)
 
__le__(self, other)
 
__lt__(self, other)
 
__ne__(self, other)
 
__or__(self, other)
 
__rand__(self, other)
 
__ror__(self, other)
 
__rsub__(self, other)
 
__rxor__(self, other)
 
__sub__(self, other)
 
__xor__(self, other)
 
_hash(self)
Compute the hash value of a set.
 
isdisjoint(self, other)
Return True if two sets have a null intersection.
    Inherited from Sized
 
__len__(self)
    Inherited from Iterable
 
__iter__(self)
    Inherited from Container
 
__contains__(self, x)
    Inherited from object
 
__delattr__(...)
x.__delattr__('name') <==> del x.name
 
__format__(...)
default object formatter
 
__getattribute__(...)
x.__getattribute__('name') <==> x.name
 
__init__(...)
x.__init__(...) initializes x; see help(type(x)) for signature
a new object with type S, a subtype of T
__new__(T, S, ...)
 
__reduce__(...)
helper for pickle
 
__reduce_ex__(...)
helper for pickle
 
__repr__(x)
repr(x)
 
__setattr__(...)
x.__setattr__('name', value) <==> x.name = value
int
__sizeof__()
size of object in memory, in bytes
 
__str__(x)
str(x)
Class Methods [hide private]
 
_from_iterable(cls, it)
Construct an instance of the class from any iterable input.
    Inherited from Sized
 
__subclasshook__(cls, C)
Abstract classes can override this to customize issubclass().
Class Variables [hide private]
  __abstractmethods__ = frozenset(['__contains__', '__iter__', '...
  __hash__ = None
hash(x)
  _abc_negative_cache = <_weakrefset.WeakSet object at 0x7fbe24d...
  _abc_registry = <_weakrefset.WeakSet object at 0x7fbe24d6a450>
    Inherited from Sized
  _abc_cache = <_weakrefset.WeakSet object at 0x7fbe24d5ff90>
  _abc_negative_cache_version = 1
Properties [hide private]
    Inherited from object
  __class__
the object's class
Method Details [hide private]

_from_iterable(cls, it)
Class Method

 

Construct an instance of the class from any iterable input.

Must override this method if the class constructor signature does not accept an iterable for an input.

_hash(self)

 

Compute the hash value of a set.

Note that we don't define __hash__: not all sets are hashable. But if you define a hashable set type, its __hash__ should call this function.

This must be compatible __eq__.

All sets ought to compare equal if they contain the same elements, regardless of how they are implemented, and regardless of the order of the elements; so there's not much freedom for __eq__ or __hash__. We match the algorithm used by the built-in frozenset type.


Class Variable Details [hide private]

__abstractmethods__

Value:
frozenset(['__contains__', '__iter__', '__len__'])

_abc_negative_cache

Value:
<_weakrefset.WeakSet object at 0x7fbe24d6a550>