Package fuzz :: Module iset :: Class IndexedSet
[hide private]
[frames] | no frames]

Class IndexedSet

source code

object --+    
         |    
       set --+
             |
            IndexedSet
Known Subclasses:

Indexed set class. This is a special type of set whose members are mutable objects with an immutable attribute. These overall-mutable members can then be accessed in dict style, using the index as key.

Nested Classes [hide private]
  _itemcls
Indexed member class.
Instance Methods [hide private]
new empty set object
__init__(self, iterable=set([]))
Constructor.
source code
object
__getitem__(self, key)
Return a set item indexed by key.
source code
 
__setitem__(self, key, item)
Assign an item by key.
source code
 
add(self, item, *args, **kwargs)
Add an item to the set.
source code
 
update(self, *args)
Update the set with the union of itself and other iterables.
source code
 
intersection_update(self, *args)
Update the set with the intersection of itself and other iterables.
source code
 
difference(self, *args)
Return the difference of the set with other iterables.
source code
 
difference_update(self, *args)
Update the set with the difference of itself and other iterables.
source code
 
symmetric_difference(self, *args)
Return the symmetric difference of the set with other iterables.
source code
 
symmetric_difference_update(self, *args)
Update the set with the symmetric difference of itself and other iterables.
source code
 
copy(self)
Return a copy of the set with shallow copies of all members.
source code
list
keys(self)
Return a list of keys in the set.
source code
bool
has_key(self, key)
Return whether this set contains an item with a given index.
source code

Inherited from set: __and__, __cmp__, __contains__, __eq__, __ge__, __getattribute__, __gt__, __iand__, __ior__, __isub__, __iter__, __ixor__, __le__, __len__, __lt__, __ne__, __new__, __or__, __rand__, __reduce__, __repr__, __ror__, __rsub__, __rxor__, __sizeof__, __sub__, __xor__, clear, discard, intersection, isdisjoint, issubset, issuperset, pop, remove, union

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

Class Variables [hide private]

Inherited from set: __hash__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, iterable=set([]))
(Constructor)

source code 

Constructor.

Parameters:
  • iterable (iterable) - The iterable to intialize the set with.
Returns: new empty set object
Overrides: object.__init__

__getitem__(self, key)
(Indexing operator)

source code 

Return a set item indexed by key.

Parameters:
  • key (object) - The index of the item to get.
Returns: object
The matching item.

__setitem__(self, key, item)
(Index assignment operator)

source code 

Assign an item by key. Normally, new items are added via add() and existing items modified via object reference; this is included for completeness.

Parameters:
  • key (object) - The index of the item to assign.
  • item (object) - The item to assign.

add(self, item, *args, **kwargs)

source code 

Add an item to the set. Uses a copy since IndexedMembers have mutable properties.

Parameters:
Overrides: set.add

update(self, *args)

source code 

Update the set with the union of itself and other iterables.

Overrides: set.update

intersection_update(self, *args)

source code 

Update the set with the intersection of itself and other iterables.

Overrides: set.intersection_update

difference(self, *args)

source code 

Return the difference of the set with other iterables.

Overrides: set.difference

difference_update(self, *args)

source code 

Update the set with the difference of itself and other iterables.

Overrides: set.difference_update

symmetric_difference(self, *args)

source code 

Return the symmetric difference of the set with other iterables.

Overrides: set.symmetric_difference

symmetric_difference_update(self, *args)

source code 

Update the set with the symmetric difference of itself and other iterables.

Overrides: set.symmetric_difference_update

copy(self)

source code 

Return a copy of the set with shallow copies of all members.

Overrides: set.copy

keys(self)

source code 

Return a list of keys in the set.

Returns: list
List of keys in the set.

has_key(self, key)

source code 

Return whether this set contains an item with a given index.

Parameters:
  • key (object) - The index to test for.
Returns: bool
True if a matching key exists, false otherwise.