Home  Trees  Indices  Help 



Classes to represent arbitrary sets (including sets of sets).
This module implements sets using dictionaries whose values are ignored. The usual operations (union, intersection, deletion, etc.) are provided as both methods and operators.
Important: sets are not sequences! While they support 'x in s', 'len(s)', and 'for x in s', none of those operations are unique for sequences; for example, mappings support all three as well. The characteristic operation for sequences is subscripting with small integers: s[i], for i in range(len(s)). Sets don't support subscripting at all. Also, sequences allow multiple occurrences and their elements have a definite order; sets on the other hand don't record multiple occurrences and don't remember the order of element insertion (which is why they don't support s[i]).
The following classes are provided:
Set  Mutable sets, subclass of BaseSet; not hashable.
Only hashable objects can be added to a Set. In particular, you cannot really add a Set as an element to another Set; if you try, what is actually added is an ImmutableSet built from it (it compares equal to the one you tried adding).
When you ask if `x in y' where x is a Set and y is a Set or ImmutableSet, x is wrapped into a _TemporarilyImmutableSet z, and what's tested is actually `z in y'.


BaseSet Common base class for mutable and immutable sets. 

ImmutableSet Immutable set class. 

Set Mutable set class. 

_TemporarilyImmutableSet 


__package__ =

Home  Trees  Indices  Help 


Generated by Epydoc 3.0.1 on Sun Mar 3 09:50:46 2013  http://epydoc.sourceforge.net 