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 AlphaDict
AlphaDict(mapping) -> new AlphaDict initialized from a mapping object’s (key, value) pairs
AlphaDict(iterable) -> new AlphaDict initialized as if via:
d = {}
for k, v in iterable:
    d[k] = v
AlphaDict(**kwargs) -> new AlphaDict initialized with the name=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 if k is in the dictionary, else default.

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.

__contains__(key)

Return key in self.

Parameters

key (object)

Return type

bool

__eq__(other)

Return self == other.

Return type

bool

__getitem__(key)

Return self[key].

Parameters

key (~KT)

Return type

~VT

__iter__()

Iterates over the dictionary’s keys.

Return type

Iterator[~KT]

__len__()

Returns the number of keys in the dictionary.

Return type

int

__repr__()

Return a string representation of the DictWrapper.

Return type

str

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 if k is in the dictionary, else default.

Parameters
  • k – The key to return the value for.

  • default – The value to return if key is not in the dictionary. Default None.

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]