Skip to content

calendar.setfirstweekday() documented parameter name does not match the implementation #153853

Description

@IbrahimShaqqou

Documentation

https://docs.python.org/3/library/calendar.html#calendar.setfirstweekday documents the module-level function as setfirstweekday(weekday), but the implementation in Lib/calendar.py is def setfirstweekday(firstweekday). The parameter can be passed by keyword, so the documented signature fails:

>>> import calendar
>>> calendar.setfirstweekday(weekday=calendar.SUNDAY)
Traceback (most recent call last):
  ...
TypeError: setfirstweekday() got an unexpected keyword argument 'weekday'
>>> calendar.setfirstweekday(firstweekday=calendar.SUNDAY)  # OK

The fix is to change the documented signature to setfirstweekday(firstweekday), matching the code and the already-correct Calendar.setfirstweekday(firstweekday) entry in the same document. I have a PR ready: #153851.

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