Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarify weekday return in calendar.monthrange docstring #120567

Closed
martinvuyk opened this issue Jun 16, 2024 · 0 comments
Closed

Clarify weekday return in calendar.monthrange docstring #120567

martinvuyk opened this issue Jun 16, 2024 · 0 comments
Labels
docs Documentation in the Doc dir

Comments

@martinvuyk
Copy link

martinvuyk commented Jun 16, 2024

Documentation

def weekday(year, month, day):
    """Return weekday (0-6 ~ Mon-Sun) for year, month (1-12), day (1-31)."""
    if not datetime.MINYEAR <= year <= datetime.MAXYEAR:
        year = 2000 + year % 400
    return Day(datetime.date(year, month, day).weekday())


def monthrange(year, month):
    """Return weekday (0-6 ~ Mon-Sun) and number of days (28-31) for
       year, month."""
    if not 1 <= month <= 12:
        raise IllegalMonthError(month)
    day1 = weekday(year, month, 1)
    ndays = mdays[month] + (month == FEBRUARY and isleap(year))
    return day1, ndays

In docs it is defined as: Returns weekday of first day of the month and number of days in month, for the specified year and month. which is clearer than what is in the code.

Linked PRs

@martinvuyk martinvuyk added the docs Documentation in the Doc dir label Jun 16, 2024
@terryjreedy terryjreedy changed the title [Docs] Calendar's monthrange docstring is unclear. Clarify calendar.monthrange weekday return Jun 16, 2024
terryjreedy added a commit to terryjreedy/cpython that referenced this issue Jun 16, 2024
@terryjreedy terryjreedy changed the title Clarify calendar.monthrange weekday return Clarify weekday return in calendar.monthrange docstring Jun 16, 2024
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Jun 16, 2024
…ing (pythonGH-120570)

(cherry picked from commit bd4516d)

Co-authored-by: Terry Jan Reedy <[email protected]>
Co-authored-by: Hugo van Kemenade <[email protected]>
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Jun 16, 2024
…ing (pythonGH-120570)

(cherry picked from commit bd4516d)

Co-authored-by: Terry Jan Reedy <[email protected]>
Co-authored-by: Hugo van Kemenade <[email protected]>
terryjreedy added a commit that referenced this issue Jun 16, 2024
…ring (GH-120570) (#120598)

gh-120567: Clarify weekday return in calendar.monthrange docstring (GH-120570)
(cherry picked from commit bd4516d)

Co-authored-by: Terry Jan Reedy <[email protected]>
Co-authored-by: Hugo van Kemenade <[email protected]>
terryjreedy added a commit that referenced this issue Jun 16, 2024
…ring (GH-120570) (#120597)

gh-120567: Clarify weekday return in calendar.monthrange docstring (GH-120570)
(cherry picked from commit bd4516d)

Co-authored-by: Terry Jan Reedy <[email protected]>
Co-authored-by: Hugo van Kemenade <[email protected]>
mrahtz pushed a commit to mrahtz/cpython that referenced this issue Jun 30, 2024
noahbkim pushed a commit to hudson-trading/cpython that referenced this issue Jul 11, 2024
estyxx pushed a commit to estyxx/cpython that referenced this issue Jul 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation in the Doc dir
Projects
None yet
Development

No branches or pull requests

2 participants