(items: Iterable[str], joiner="or")
| 169 | |
| 170 | |
| 171 | def commas(items: Iterable[str], joiner="or") -> str: |
| 172 | items = tuple(items) |
| 173 | if not items: |
| 174 | return "" |
| 175 | if len(items) == 1: |
| 176 | return items[0] |
| 177 | return f"{', '.join(items[:-1])} {joiner} {items[-1]}" |
| 178 | |
| 179 | |
| 180 | if __name__ == "__main__": # pragma: no cover |
no outgoing calls