GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Convert calendar constants to enums and add months · Issue #103636 · python/cpython

Convert calendar constants to enums and add months #103636

New issue
Copy link
New issue
Copy link
Closed
Closed
Convert calendar constants to enums and add months#103636
Copy link
Labels
3.12only security fixesonly security fixesstdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-featureA feature request or enhancementA feature request or enhancement

Description

@ethanfurman
ethanfurman
opened on Apr 19, 2023
Issue body actions

From this discuss thread:

The calendar module already defines constants e.g. MONDAY (0), TUESDAY (1), etc. for the [days of the week] https://docs.python.org/3/library/calendar.html#calendar.MONDAY).

Since these are likely to be commonly needed too, would it make sense for the calendar module to also export constants for all of JANUARY (1), FEBRUARY (2), …, DECEMBER (12)?

This would allow one to write from calendar import APRIL and then e.g. use APRIL instead of 4 when building a datetime.date object.

Related: datetime - Python module defining constants for month numbers? - Stack Overflow

Linked PRs

  • gh-103636: add enums for days and months in calendar module #103642
  • gh-103636: issue warning for deprecated calendar constants #103833
Reacted by Florian Obersteiner

Activity

  1. ethanfurman
    added
    type-featureA feature request or enhancementA feature request or enhancement
    stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directory
    3.12only security fixesonly security fixes
    on Apr 19, 2023
  2. Agent-Hellboy commented on Apr 20, 2023

    @Agent-Hellboy
    Agent-Hellboy
    on Apr 20, 2023
    Contributor
    More actions

    looks easy, I would like to raise a PR?

  3. ethanfurman commented on Apr 20, 2023

    @ethanfurman
    ethanfurman
    on Apr 20, 2023
    MemberAuthor
    More actions

    @Agent-Hellboy Please do!

  4. Agent-Hellboy commented on Apr 20, 2023

    @Agent-Hellboy
    Agent-Hellboy
    on Apr 20, 2023
    Contributor
    More actions

    Sure😊

  5. Agent-Hellboy
    added 7 commits that reference this issue on Apr 20, 2023

    pythongh-103636: Convert Calander consts to enum and add consts for m…

    32e9466

    pythongh-103636: Convert Calander consts to enum and add consts for m…

    7172358

    pythongh-103636: Convert Calander consts to enum and add consts for m…

    ac4867c

    pythongh-103636: Convert Calander consts to enum and add consts for m…

    5cacc5a

    pythongh-103636: Convert Calander consts to enum and add consts for m…

    97a6011

    pythongh-103636: Convert Calander consts to enum and add consts for m…

    c74af07

    pythongh-103636: Convert Calander consts to enum and add consts for m…

    e8ddb8d
  6. Sergo2106 commented on Apr 21, 2023

    @Sergo2106
    Sergo2106
    on Apr 21, 2023 · Hidden as off-topic
    show commentMore actions
  7. Agent-Hellboy
    added a commit that references this issue on Apr 21, 2023

    pythongh-103636: Convert Calander consts to enum and add consts for m…

    e0427ba
  8. ethanfurman
    added a commit that references this issue on Apr 25, 2023

    gh-103636: add enums for days and months in calendar module (GH-103642)

    b934f97
  9. ethanfurman commented on Apr 25, 2023

    @ethanfurman
    ethanfurman
    on Apr 25, 2023
    MemberAuthor
    More actions

    Let's also add a module-level __getattr__ to provide the January and February constants and issue a warning when that happens.

    Reacted by Hugo van Kemenade
  10. Agent-Hellboy commented on Apr 25, 2023

    @Agent-Hellboy
    Agent-Hellboy
    on Apr 25, 2023
    Contributor
    More actions

    okay, I will create a PR

    Reacted by Hugo van Kemenade
  11. Agent-Hellboy
    added a commit that references this issue on Apr 25, 2023

    pythongh-103636: raise warning for January and February attribute

    175dadf
  12. hugovk commented on Apr 26, 2023

    @hugovk
    hugovk
    on Apr 26, 2023
    Member
    More actions

    Let's also document the additions from #103642 at https://docs.python.org/3.12/library/calendar.html with a .. versionadded:: 3.12, and also add to https://docs.python.org/3.12/whatsnew/3.12.html#improved-modules

  13. hugovk
    added a commit that references this issue on Apr 29, 2023

    gh-103636: issue warning for deprecated calendar constants (#103833)

    84e7d0f
  14. hugovk commented on Apr 29, 2023

    @hugovk
    hugovk
    on Apr 29, 2023
    Member
    More actions

    I think we're all set here:

    • https://docs.python.org/3.12/whatsnew/3.12.html#calendar
    • https://docs.python.org/3.12/whatsnew/3.12.html#deprecated

    Thanks!

  15. hugovk
    closed this as completedon Apr 29, 2023
  16. carljm
    added a commit that references this issue on May 1, 2023

    Merge branch 'main' into supermon

    159b2aa
  17. StanFromIreland
    added this to Date and time issues 🕰️on Jun 28, 2025
  18. StanFromIreland
    moved this to Done in Date and time issues 🕰️on Jun 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.12only security fixesonly security fixesstdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-featureA feature request or enhancementA feature request or enhancement

    Projects

    • Date and time issues 🕰️
      Status
      Done
      Show more project fields

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402503 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.