fix behavior with two items

This commit is contained in:
InspectorCaracal 2022-12-26 10:31:51 -07:00
parent 0bde1a034b
commit 7b2cb92b60
2 changed files with 2 additions and 1 deletions

View file

@ -448,7 +448,7 @@ def iter_to_str(iterable, sep=",", endsep=", and", addquote=False):
iterable = tuple(str(val) for val in iterable)
if endsep:
if endsep.startswith(sep):
if endsep.startswith(sep) and endsep != sep:
# oxford comma alternative
endsep = endsep[1:] if len_iter < 3 else endsep
elif endsep[0] not in punctuation: