### Navigation

- index
- modules |
- next |
- previous |
- pyFormex v0.8.6 documentation >
- pyFormex reference manual >

# 56. `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 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.

  `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.

  `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`

### Navigation

- index
- modules |
- next |
- previous |
- pyFormex v0.8.6 documentation >
- pyFormex reference manual >