Skip to content

Use serial comma in 'natural_list' output by default, and allow optional omission #211

@bignose-debian

Description

@bignose-debian

The 'natural_list' behaviour hard-codes the omission of serial comma in the formatted output.

To reduce ambiguity in the normal case, the serial comma should be default.

Expected:

>>> humanize.natural_list([1, 2, 3, 4, 5])
'1, 2, 3, 4, and 5'

To allow the caller to choose the non-default omission of serial comma, a keyword-only parameter should be added to specify this.

Expected:

>>> humanize.natural_list([1, 2, 3, 4, 5], serial_comma=True)
'1, 2, 3, 4, and 5'
>>> humanize.natural_list([1, 2, 3, 4, 5], serial_comma=False)
'1, 2, 3, 4 and 5'

(The “serial comma” is sometimes known as the “Oxford comma”.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions