Package dns :: Module set :: Class Set
[show private | hide private]
[frames | no frames]

Class Set

object --+
         |
        Set

Known Subclasses:
Rdataset

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.
  __eq__(self, other)
  __iadd__(self, other)
  __iand__(self, other)
  __ior__(self, other)
  __isub__(self, other)
  __iter__(self)
  __len__(self)
  __ne__(self, other)
a new object with type S, a subtype of T __new__(S, ...)
  __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.

Instance Variable Summary
  items - A list of the items which are in the set

Class Variable Summary
list __slots__
list items

Method Details

__init__(self, items=None)
(Constructor)

Initialize the set.
Parameters:
items - the initial set of items
           (type=any iterable or None)

__copy__(self)

Make a (shallow) copy of the set.

__new__(S, ...)

Returns:
a new object with type S, a subtype of T

add(self, item)

Add an item to the set.

clear(self)

Make the set empty.

copy(self)

Make a (shallow) copy of the set.

difference(self, other)

Return a new set which self - other, i.e. the items in self which are not also in other.
Parameters:
other - the other set
           (type=Set object)
Returns:
the same type as self

difference_update(self, other)

Update the set, removing any elements from other which are in the set.
Parameters:
other - the collection of items with which to update the set
           (type=Set object)

discard(self, item)

Remove an item from the set if present.

intersection(self, other)

Return a new set which is the intersection of self and other.
Parameters:
other - the other set
           (type=Set object)
Returns:
the same type as self

intersection_update(self, other)

Update the set, removing any elements from other which are not in both sets.
Parameters:
other - the collection of items with which to update the set
           (type=Set object)

issubset(self, other)

Is self a subset of other?
Returns:
bool

issuperset(self, other)

Is self a superset of other?
Returns:
bool

remove(self, item)

Remove an item from the set.

union(self, other)

Return a new set which is the union of self and other.
Parameters:
other - the other set
           (type=Set object)
Returns:
the same type as self

union_update(self, other)

Update the set, adding any elements from other which are not already in the set.
Parameters:
other - the collection of items with which to update the set
           (type=Set object)

update(self, other)

Update the set, adding any elements from other which are not already in the set.
Parameters:
other - the collection of items with which to update the set
           (type=any iterable type)

Instance Variable Details

items

A list of the items which are in the set

Class Variable Details

__slots__

Type:
list
Value:
['items']                                                              

items

Type:
list
Value:
<member 'items' of 'Set' objects>                                      

Generated by Epydoc 1.1 on Sun Jun 6 13:48:46 2004 http://epydoc.sf.net