The handle_plural_values() method previously used a manual loop to remove leading whitespace from values after splitting the string by ;.
The implementation looked like this:
values = plural_value.split(";")
Remove trailing leading whitespace
for i in range(len(values)):
current = i + 1
if current < len(values):
clean_value = values[current].lstrip()
values[current] = clean_value
This approach had a few issues:
It only removed leading whitespace (lstrip) and not trailing whitespace.
It unnecessarily used an index-based loop, making the code more complex than needed.
The logic skipped the first element and only cleaned subsequent ones.
Python provides a more concise and readable way to perform this operation.