Skip to content

Docs: calendar.calendar and calendar.prcal document parameter as year but it is named theyear #153926

Description

@fedonman

Documentation

The module-level functions calendar.calendar() and calendar.prcal() document their first parameter as year:

.. function:: prcal(year, w=0, l=0, c=6, m=3)

.. function:: calendar(year, w=2, l=1, c=6, m=3)

However, both are bound methods of the module's TextCalendar instance (calendar = c.formatyear, prcal = c.pryear in Lib/calendar.py), whose first parameter is named theyear:

>>> import calendar, inspect
>>> inspect.signature(calendar.calendar)
<Signature (theyear, w=2, l=1, c=6, m=3)>
>>> inspect.signature(calendar.prcal)
<Signature (theyear, w=0, l=0, c=6, m=3)>

As a result the documented keyword name does not work — calendar.calendar(year=2025) raises TypeError, while calendar.calendar(theyear=2025) succeeds.

The documentation should be updated to use the real parameter name theyear, which also matches the sibling month() and prmonth() functions documented just above.

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    docsDocumentation in the Doc dir

    Fields

    No fields configured for issues without a type.

    Projects

    Status
    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions