Skip to main content

lax_dict

No overview available.

def lax_dict(
input_sequence: iterable
) - > dict

Creates a dictionary from a sequence of key-value pairs while ignoring any pairs that do not contain exactly two elements. This is useful for safely parsing potentially malformed input sequences into a dictionary without raising a ValueError.

Parameters

NameTypeDescription
input_sequenceiterableAn iterable of sequences (like tuples or lists) to be converted into dictionary entries.

Returns

TypeDescription
dictA dictionary containing only the valid key-value pairs extracted from the input sequence.