Skip to content

gh-108202: Document calendar.Calendar.firstweekday #128566

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

Conversation

erlend-aasland
Copy link
Contributor

@erlend-aasland erlend-aasland commented Jan 6, 2025

Follow-up to #127579. I think we should promote the more pythonic property API, rather than the setter/getter pair.


📚 Documentation preview 📚: https://cpython-previews--128566.org.readthedocs.build/

Copy link
Contributor

@eendebakpt eendebakpt left a comment

Choose a reason for hiding this comment

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

Looks good to me. Either 0-6 or 0--6 would be fine with me, but to be consistent: there is one more 0-6 in the file (for IllegalWeekdayError)

@erlend-aasland
Copy link
Contributor Author

I noticed, but double dash is used for many other ranges in this file. Amending all of those can be left for another PR.


This property can also be set and read using
:meth:`~Calendar.setfirstweekday` and
:meth:`~Calendar.getfirstweekday` respectively.
Copy link
Member

Choose a reason for hiding this comment

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

It might be worth recommending usage of either the attribute or the methods, per the zen:

There should be one-- and preferably only one --obvious way to do it.

If you want though, I'm fine to leave it as is. I'm just being nitpicky :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I considered that, but I think the zen train already left the calendar module API :) IMO, a better approach would be to soft deprecate the set/get method pair.

@erlend-aasland erlend-aasland merged commit b3cbd8f into python:main Jan 7, 2025
29 checks passed
@erlend-aasland erlend-aasland deleted the docs/calendar-firstweekday-attr branch January 7, 2025 07:59
@miss-islington-app
Copy link

Thanks @erlend-aasland for the PR 🌮🎉.. I'm working now to backport this PR to: 3.12, 3.13.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jan 7, 2025
…8566)

(cherry picked from commit b3cbd8f)

Co-authored-by: Erlend E. Aasland <erlend@python.org>
@erlend-aasland
Copy link
Contributor Author

Thanks for the reviews, everyone!

@bedevere-app
Copy link

bedevere-app bot commented Jan 7, 2025

GH-128579 is a backport of this pull request to the 3.13 branch.

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jan 7, 2025
…8566)

(cherry picked from commit b3cbd8f)

Co-authored-by: Erlend E. Aasland <erlend@python.org>
@bedevere-app bedevere-app bot removed the needs backport to 3.13 bugs and security fixes label Jan 7, 2025
@bedevere-app
Copy link

bedevere-app bot commented Jan 7, 2025

GH-128580 is a backport of this pull request to the 3.12 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.12 only security fixes label Jan 7, 2025
erlend-aasland added a commit that referenced this pull request Jan 7, 2025
…#128579)

(cherry picked from commit b3cbd8f)

Co-authored-by: Erlend E. Aasland <erlend@python.org>
erlend-aasland added a commit that referenced this pull request Jan 7, 2025
…#128580)

(cherry picked from commit b3cbd8f)

Co-authored-by: Erlend E. Aasland <erlend@python.org>
srinivasreddy pushed a commit to srinivasreddy/cpython that referenced this pull request Jan 8, 2025
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 skip news
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

4 participants