finesse.utilities.text.option_list

finesse.utilities.text.option_list(sequence, final_sep='or', quotechar=None, sort=False, prefix=None)[source]

Build a list from sequence with commas and a final “or”.

As in Python’s error messages (e.g. “‘func’ missing 3 requied positional arguments: ‘a’, ‘b’, and ‘c’”), this function adds an Oxford comma for sequences of length > 2.

Parameters
sequencesequence

The options to create a list with.

final_sepstr, optional

The final separator when sequence has more than one item. Defaults to or.

quotecharstr, optional

Quote the items in sequence with this character. Defaults to no quotes.

sortbool, optional

Sort the items sequence alphabetically. Defaults to false.

prefixstr, optional

Concatenates the prefix with all items in sequence. Defaults to false.