AlphaDict¶
-
class
AlphaDict
(seq=None, **kwargs)[source]¶ Bases:
FrozenOrderedDict
[~KT
,~VT
]Initialize an immutable, alphabetised dictionary.
The signature is the same as regular dictionaries.
AlphaDict()
-> new empty AlphaDictAlphaDict(mapping)
-> new AlphaDict initialized from a mapping object’s (key, value) pairsAlphaDict(iterable)
-> new AlphaDict initialized as if via:d = {} for k, v in iterable: d[k] = v
AlphaDict(**kwargs)
-> new AlphaDict initialized with thename=value
pairs in the keyword argument list.For example:
AlphaDict(one=1, two=2)
Methods:
__contains__
(key)Return
key in self
.__eq__
(other)Return
self == other
.__getitem__
(key)Return
self[key]
.__iter__
()Iterates over the dictionary’s keys.
__len__
()Returns the number of keys in the dictionary.
__repr__
()Return a string representation of the
DictWrapper
.copy
(*args, **kwargs)Return a copy of the
FrozenOrderedDict
.fromkeys
(iterable[, value])Create a new dictionary with keys from iterable and values set to value.
get
(k[, default])Return the value for
k
ifk
is in the dictionary, elsedefault
.items
()Returns a set-like object providing a view on the
FrozenOrderedDict
's items.keys
()Returns a set-like object providing a view on the
FrozenOrderedDict
's keys.values
()Returns an object providing a view on the
FrozenOrderedDict
's values.-
__getitem__
(key)¶ Return
self[key]
.- Parameters
key (
~KT
)- Return type
~VT
-
__repr__
()¶ Return a string representation of the
DictWrapper
.- Return type
-
copy
(*args, **kwargs)¶ Return a copy of the
FrozenOrderedDict
.- Parameters
args
kwargs
-
classmethod
fromkeys
(iterable, value=None)¶ Create a new dictionary with keys from iterable and values set to value.
- Return type
FrozenBase
[~KT
,~VT
]
-
get
(k, default=None)¶ Return the value for
k
ifk
is in the dictionary, elsedefault
.- Parameters
k – The key to return the value for.
default – The value to return if
key
is not in the dictionary. DefaultNone
.
-
items
()¶ Returns a set-like object providing a view on the
FrozenOrderedDict
's items.- Return type
AbstractSet
[Tuple
[~KT
,~VT
]]
-
keys
()¶ Returns a set-like object providing a view on the
FrozenOrderedDict
's keys.- Return type
AbstractSet
[~KT
]
-
values
()¶ Returns an object providing a view on the
FrozenOrderedDict
's values.- Return type
ValuesView
[~VT
]
-