Skip to content

Commit 5d936b6

Browse files
authored
GH-108202: Combine documentation of calendar constants (#108492)
1 parent d0160c7 commit 5d936b6

File tree

3 files changed

+52
-63
lines changed

3 files changed

+52
-63
lines changed

Doc/library/calendar.rst

Lines changed: 49 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -28,58 +28,6 @@ interpreted as prescribed by the ISO 8601 standard. Year 0 is 1 BC, year -1 is
2828
2 BC, and so on.
2929

3030

31-
.. class:: Day
32-
33-
Enumeration defining the days of the week as integer constants, from 0 to 6.
34-
35-
.. attribute:: MONDAY
36-
37-
.. attribute:: TUESDAY
38-
39-
.. attribute:: WEDNESDAY
40-
41-
.. attribute:: THURSDAY
42-
43-
.. attribute:: FRIDAY
44-
45-
.. attribute:: SATURDAY
46-
47-
.. attribute:: SUNDAY
48-
49-
.. versionadded:: 3.12
50-
51-
52-
.. class:: Month
53-
54-
Enumeration defining months of the year as integer constants, from 1 to 12.
55-
56-
.. attribute:: JANUARY
57-
58-
.. attribute:: FEBRUARY
59-
60-
.. attribute:: MARCH
61-
62-
.. attribute:: APRIL
63-
64-
.. attribute:: MAY
65-
66-
.. attribute:: JUNE
67-
68-
.. attribute:: JULY
69-
70-
.. attribute:: AUGUST
71-
72-
.. attribute:: SEPTEMBER
73-
74-
.. attribute:: OCTOBER
75-
76-
.. attribute:: NOVEMBER
77-
78-
.. attribute:: DECEMBER
79-
80-
.. versionadded:: 3.12
81-
82-
8331
.. class:: Calendar(firstweekday=0)
8432

8533
Creates a :class:`Calendar` object. *firstweekday* is an integer specifying the
@@ -446,6 +394,29 @@ The :mod:`calendar` module exports the following data attributes:
446394
An array that represents the abbreviated days of the week in the current locale.
447395

448396

397+
.. data:: MONDAY
398+
TUESDAY
399+
WEDNESDAY
400+
THURSDAY
401+
FRIDAY
402+
SATURDAY
403+
SUNDAY
404+
405+
Aliases for the days of the week,
406+
where ``MONDAY`` is ``0`` and ``SUNDAY`` is ``6``.
407+
408+
.. versionadded:: 3.12
409+
410+
411+
.. class:: Day
412+
413+
Enumeration defining days of the week as integer constants.
414+
The members of this enumeration are exported to the module scope as
415+
:data:`MONDAY` through :data:`SUNDAY`.
416+
417+
.. versionadded:: 3.12
418+
419+
449420
.. data:: month_name
450421

451422
An array that represents the months of the year in the current locale. This
@@ -459,15 +430,33 @@ The :mod:`calendar` module exports the following data attributes:
459430
locale. This follows normal convention of January being month number 1, so it
460431
has a length of 13 and ``month_abbr[0]`` is the empty string.
461432

462-
.. data:: MONDAY
463-
TUESDAY
464-
WEDNESDAY
465-
THURSDAY
466-
FRIDAY
467-
SATURDAY
468-
SUNDAY
469433

470-
Aliases for day numbers, where ``MONDAY`` is ``0`` and ``SUNDAY`` is ``6``.
434+
.. data:: JANUARY
435+
FEBRUARY
436+
MARCH
437+
APRIL
438+
MAY
439+
JUNE
440+
JULY
441+
AUGUST
442+
SEPTEMBER
443+
OCTOBER
444+
NOVEMBER
445+
DECEMBER
446+
447+
Aliases for the months of the year,
448+
where ``JANUARY`` is ``1`` and ``DECEMBER`` is ``12``.
449+
450+
.. versionadded:: 3.12
451+
452+
453+
.. class:: Month
454+
455+
Enumeration defining months of the year as integer constants.
456+
The members of this enumeration are exported to the module scope as
457+
:data:`JANUARY` through :data:`DECEMBER`.
458+
459+
.. versionadded:: 3.12
471460

472461

473462
The :mod:`calendar` module defines the following exceptions:

Doc/whatsnew/3.12.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1013,7 +1013,7 @@ Deprecated
10131013
(Contributed by Serhiy Storchaka and Guido van Rossum in :gh:`100160`.)
10141014

10151015
* :mod:`calendar`: ``calendar.January`` and ``calendar.February`` constants are deprecated and
1016-
replaced by :data:`calendar.Month.JANUARY` and :data:`calendar.Month.FEBRUARY`.
1016+
replaced by :data:`calendar.JANUARY` and :data:`calendar.FEBRUARY`.
10171017
(Contributed by Prince Roshan in :gh:`103636`.)
10181018

10191019
* :mod:`datetime`: :class:`datetime.datetime`'s :meth:`~datetime.datetime.utcnow` and

Doc/whatsnew/3.13.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -438,8 +438,8 @@ although there is currently no date scheduled for their removal.
438438
* Delegation of ``int()`` to ``__trunc__()`` method.
439439

440440
* :mod:`calendar`: ``calendar.January`` and ``calendar.February`` constants are
441-
deprecated and replaced by :data:`calendar.Month.JANUARY` and
442-
:data:`calendar.Month.FEBRUARY`.
441+
deprecated and replaced by :data:`calendar.JANUARY` and
442+
:data:`calendar.FEBRUARY`.
443443
(Contributed by Prince Roshan in :gh:`103636`.)
444444

445445
* :mod:`datetime`:

0 commit comments

Comments
 (0)