8000 gh-127553: Remove `TODO` comment in `_pydatetime._isoweek1monday` by bombs-kim · Pull Request #127564 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-127553: Remove TODO comment in _pydatetime._isoweek1monday #127564

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

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Adds a comment about the need for week addition
  • Loading branch information
bombs-kim committed Dec 3, 2024
commit 604f61a04646e6fc1d7350faecd23783d15e7b00
2 changes: 2 additions & 0 deletions Lib/_pydatetime.py
Original file line number Diff line number Diff line change
Expand Up @@ -2395,6 +2395,8 @@ def _isoweek1monday(year):
THURSDAY = 3
firstday = _ymd2ord(year, 1, 1)
firstweekday = (firstday + 6) % 7 # See weekday() above
# If the first weekday is after Thursday,
# ISO week 1 doesn't start until the next Monday
Copy link
Member
@picnixz picnixz Dec 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment should be moved inside the if and I would only keep "ISO week 1 does not start until the next Monday" (or maybe no comment at all). Waiting for Erlend's opinion on this.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure the comment is needed. The code below speaks for itself, IMO. Let's just remove the XXX comment. After all, that is what the PR title says this PR should do.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@erlend-aasland Got it! I've reverted the change

week1monday = firstday - firstweekday
if firstweekday > THURSDAY:
week1monday += 7
Expand Down
Loading
0