specio.core.Dict

class specio.core.Dict(*args, **kwds)[source][source]

A dict in which the keys can be get and set as if they were attributes. Very convenient in combination with autocompletion.

This Dict still behaves as much as possible as a normal dict, and keys can be anything that are otherwise valid keys. However, keys that are not valid identifiers or that are names of the dict class (such as ‘items’ and ‘copy’) cannot be get/set as attributes.

__init__(*args, **kwds)[source]

Initialize an ordered dictionary. The signature is the same as regular dictionaries, but keyword arguments are not recommended because their insertion order is arbitrary.

Methods

__init__(*args, **kwds) Initialize an ordered dictionary.
clear()
copy()
fromkeys(S[, v]) If not specified, the value defaults to None.
get(k[,d])
has_key(k)
items()
iteritems() od.iteritems -> an iterator over the (key, value) pairs in od
iterkeys()
itervalues() od.itervalues -> an iterator over the values in od
keys()
pop(k[,d]) value. If key is not found, d is returned if given, otherwise KeyError
popitem() Pairs are returned in LIFO order if last is true or FIFO order if false.
setdefault(k[,d])
update([E, ]**F) If E present and has a .keys() method, does: for k in E: D[k] = E[k]
values()
viewitems()
viewkeys()
viewvalues()
clear() → None. Remove all items from od.[source]
copy() → a shallow copy of od[source]
fromkeys(S[, v]) → New ordered dictionary with keys from S.[source]

If not specified, the value defaults to None.

get(k[, d]) → D[k] if k in D, else d. d defaults to None.
has_key(k) → True if D has a key k, else False
items() → list of (key, value) pairs in od[source]
iteritems()[source]

od.iteritems -> an iterator over the (key, value) pairs in od

iterkeys() → an iterator over the keys in od[source]
itervalues()[source]

od.itervalues -> an iterator over the values in od

keys() → list of keys in od[source]
pop(k[, d]) → v, remove specified key and return the corresponding[source]

value. If key is not found, d is returned if given, otherwise KeyError is raised.

popitem() → (k, v), return and remove a (key, value) pair.[source]

Pairs are returned in LIFO order if last is true or FIFO order if false.

setdefault(k[, d]) → od.get(k,d), also set od[k]=d if k not in od[source]
update([E, ]**F) → None. Update D from mapping/iterable E and F.[source]

If E present and has a .keys() method, does: for k in E: D[k] = E[k] If E present and lacks .keys() method, does: for (k, v) in E: D[k] = v In either case, this is followed by: for k, v in F.items(): D[k] = v

values() → list of values in od[source]
viewitems() → a set-like object providing a view on od's items[source]
viewkeys() → a set-like object providing a view on od's keys[source]
viewvalues() → an object providing a view on od's values[source]