A simple set class.
Sets are not in Python until 2.3, and rdata are not immutable so we
cannot use sets.Set anyway. This class implements subset of the 2.3 Set
interface using a list as the container.
Method Summary |
|
__init__ (self,
items)
Initialize the set. |
|
__add__(self,
other)
|
|
__and__(self,
other)
|
|
__copy__ (self)
Make a (shallow) copy of the set. |
|
__delitem__(self,
i)
|
|
__delslice__(self,
i,
j)
|
|
__eq__(self,
other)
|
|
__getitem__(self,
i)
|
|
__getslice__(self,
i,
j)
|
|
__iadd__(self,
other)
|
|
__iand__(self,
other)
|
|
__ior__(self,
other)
|
|
__isub__(self,
other)
|
|
__iter__(self)
|
|
__len__(self)
|
|
__ne__(self,
other)
|
|
__or__(self,
other)
|
|
__repr__(self)
|
|
__sub__(self,
other)
|
|
add (self,
item)
Add an item to the set. |
|
clear (self)
Make the set empty. |
|
copy (self)
Make a (shallow) copy of the set. |
the same type as self
|
difference (self,
other)
Return a new set which self - other, i.e. |
|
difference_update (self,
other)
Update the set, removing any elements from other which are in the
set. |
|
discard (self,
item)
Remove an item from the set if present. |
the same type as self
|
intersection (self,
other)
Return a new set which is the intersection of self and
other. |
|
intersection_update (self,
other)
Update the set, removing any elements from other which are not in both
sets. |
bool
|
issubset (self,
other)
Is self a subset of other? |
bool
|
issuperset (self,
other)
Is self a superset of other? |
|
remove (self,
item)
Remove an item from the set. |
the same type as self
|
union (self,
other)
Return a new set which is the union of self and
other. |
|
union_update (self,
other)
Update the set, adding any elements from other which are not already
in the set. |
|
update (self,
other)
Update the set, adding any elements from other which are not already
in the set. |
|
_clone (self)
Make a (shallow) copy of the set. |
Inherited from object |
|
__delattr__ (...)
x.__delattr__('name') <==> del x.name |
|
__getattribute__ (...)
x.__getattribute__('name') <==> x.name |
|
__hash__ (x)
x.__hash__() <==> hash(x) |
|
__new__ (T,
S,
...)
T.__new__(S, ...) -> a new object with type S, a subtype of T |
|
__reduce__ (...)
helper for pickle |
|
__reduce_ex__ (...)
helper for pickle |
|
__setattr__ (...)
x.__setattr__('name', value) <==> x.name = value |
|
__str__ (x)
x.__str__() <==> str(x) |