qspec logo qspec logo

A physics toolbox for laser spectroscopy.

Static Badge Static Badge Static Badge

Static Badge Static Badge

© 2026 Patrick Müller. All rights reserved.

qspec. make_str_iterable_unique  (  a ,  identifier=None  )[source]

Make the values of a list of strings unique by appending identifiers to values that appear more than once. Equal values are grouped together, e.g., ["a", "b", "c", "b", "d"] becomes ["a", "b_0", "b_1", "c", "d"] or ["a", "b_" + identifier[0], "b_" + identifier[1], "c", "d"].

Parameters:
aIterable[str]

An iterable of str values.

identifierIterable[str] | None

An iterable of str values to append to the values of a if they appear more than once. If None, "_i" is appended to the i-th appearance of a value in a.

Returns:
a_uniquelist[str]

The unique values.