-
-
Notifications
You must be signed in to change notification settings - Fork 31.7k
calendar.day_name returns a class object and not array #123445
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
Comments
Confirmed Python 3.10.12 (main, Jul 29 2024, 16:56:48) [GCC 11.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import calendar
>>> calendar.day_name
<calendar._localized_day object at 0x7fd3b687a020>
>>> [x for x in calendar.day_name]
['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'] |
Would you like to create a PR to correct the text and add an example? |
We just need to change "array" to "sequence". The same for We can also add more human readable repr for these sequences. But this is only for a new version. |
I agree with @serhiy-storchaka that there's no need to be more specific than "sequence". I don't see the need to be more specific here and constrain any future changes. |
I made a PR at #123483 |
#123483) Co-authored-by: Adam Turner <[email protected]> Co-authored-by: Eric V. Smith <[email protected]> Co-authored-by: Hugo van Kemenade <[email protected]>
…ributes (pythonGH-123483) (cherry picked from commit 8447c93) Co-authored-by: Mat S <[email protected]> Co-authored-by: Adam Turner <[email protected]> Co-authored-by: Eric V. Smith <[email protected]> Co-authored-by: Hugo van Kemenade <[email protected]>
…ributes (pythonGH-123483) (cherry picked from commit 8447c93) Co-authored-by: Mat S <[email protected]> Co-authored-by: Adam Turner <[email protected]> Co-authored-by: Eric V. Smith <[email protected]> Co-authored-by: Hugo van Kemenade <[email protected]>
…tributes (GH-123483) (#124501) gh-123445: calendar: Improve descriptions for day and month attributes (GH-123483) (cherry picked from commit 8447c93) Co-authored-by: Mat S <[email protected]> Co-authored-by: Adam Turner <[email protected]> Co-authored-by: Eric V. Smith <[email protected]> Co-authored-by: Hugo van Kemenade <[email protected]>
…tributes (GH-123483) (#124500) gh-123445: calendar: Improve descriptions for day and month attributes (GH-123483) (cherry picked from commit 8447c93) Co-authored-by: Mat S <[email protected]> Co-authored-by: Adam Turner <[email protected]> Co-authored-by: Eric V. Smith <[email protected]> Co-authored-by: Hugo van Kemenade <[email protected]>
Documentation
In the https://docs.python.org/3/library/calendar.html#calendar.day_name, its mentioned day_name returns "An array that represents the days of the week in the current locale." but it returns a class object. Also, it would be helpful to provide documentation with regards to how to use the object returned to obtain the day names.
Linked PRs
The text was updated successfully, but these errors were encountered: