Skip to main content

OrderedDict

Dict where insertion order matters.

Constructor​

Signature​

def OrderedDict() - > null

Methods​


move_to_end()​

@classmethod
def move_to_end(
key: Any,
last: bool = True
) - > None

Moves an existing key to either the beginning or the end of the ordered dictionary.

Parameters​

NameTypeDescription
keyAnyThe existing dictionary key to be relocated within the insertion order.
lastbool = TrueA flag determining the destination; if True, the key is moved to the end, and if False, it is moved to the beginning.

Returns​

TypeDescription
NoneNothing is returned; the dictionary is modified in-place.