scallop dome pyformex logo

Previous topic

69. mydict

Next topic

71. collection — Tools for handling collections of elements belonging to multiple parts.

[FSF Associate Member]

Valid XHTML 1.0 Transitional

70. odict — Specialized dictionary type structures.

Classes defined in module odict

class odict.ODict(data={})

An ordered dictionary.

This is a dictionary that keeps the keys in order. The default order is the insertion order. The current order can be changed at any time.

The ODict can be initialized with a Python dict, a list of (key,value) tuples, or another ODict object. If a plain Python dict is used, the resulting order is undefined.

update(data={})

Add a dictionary to the ODict object.

The new keys will be appended to the existing, but the order of the added keys is undetemined if data is a dict object. If data is an ODict its order will be respected..

sort(keys)

Set the order of the keys.

keys should be a list containing exactly all the keys from self.

keys()

Return the keys in order.

values()

Return the values in order of the keys.

items()

Return the key,value pairs in order of the keys.

iteritems()

Return the key,value pairs in order of the keys.

pos(key)

Return the position of the specified key.

If the key is not in the ODict, None is returned

class odict.KeyedList(alist=[])

A named item list.

A KeyedList is a list of lists or tuples. Each item (sublist or tuple) should at least have 2 elements: the first one is used as a key to identify the item, but is also part of the information (value) of the item.

items()

Return the key+value lists in order of the keys.

update(data={})

Add a dictionary to the ODict object.

The new keys will be appended to the existing, but the order of the added keys is undetemined if data is a dict object. If data is an ODict its order will be respected..

sort(keys)

Set the order of the keys.

keys should be a list containing exactly all the keys from self.

keys()

Return the keys in order.

values()

Return the values in order of the keys.

iteritems()

Return the key,value pairs in order of the keys.

pos(key)

Return the position of the specified key.

If the key is not in the ODict, None is returned

Functions defined in module odict