Skip to content

concatenate - serial comma incorrectly used with two items #63

@jsamarziya

Description

@jsamarziya

Per Wikipedia, a serial comma is

a comma placed immediately after the penultimate term... in a series of three or more terms

We would therefore expect that a serial comma would not be placed by concatenate() when given a sequence of two items, but this is not the case.

Expected:

>>> humanfriendly.text.concatenate(items=["foo", "bar"], serial_comma=True)
'foo and bar'

Actual:

>>> humanfriendly.text.concatenate(items=["foo", "bar"], serial_comma=True)
'foo, and bar'

Workaround:

>>> items = ["foo", "bar"]
>>> humanfriendly.text.concatenate(items=items, serial_comma=len(items) > 2)
'foo and bar'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions