Stay organized with collections Save and categorize content based on your preferences.

Returns struct as an collections.OrderedDict or tuple, if possible.

If all elements of struct have names, convert struct to an collections.OrderedDict. If no element has a name, convert struct to a tuple. If struct has both named and unnamed elements, raise an error.

struct A Struct.
recursive Whether to convert nested Structs recursively.

ValueError If struct (or any nested Struct when recursive=True) contains both named and unnamed elements.