Skip to main content

flatten_choices

Flatten choices by removing nested values.

def flatten_choices(
choices: iterable
) - > generator

Flatten choices by removing nested values.

Parameters

NameTypeDescription
choicesiterableAn iterable of choice tuples or grouped choices, typically used in form fields or select inputs.

Returns

TypeDescription
generatorA generator yielding flat key-value pairs, where nested groups have been expanded into their individual choice tuples.