[issue46266] Improve day constants (`MONDAY` ... `SUNDAY`) in `calendar.py`

2022-01-22 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset f66ef3eab62c6d262ddbc8ab16fb43c8921ad33a by Miss Islington (bot) 
in branch '3.10':
bpo-46266:  Add calendar day of week constants to __all__  (GH-30412) (GH-30424)
https://github.com/python/cpython/commit/f66ef3eab62c6d262ddbc8ab16fb43c8921ad33a


--
nosy: +vstinner

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46266] Improve day constants (`MONDAY` ... `SUNDAY`) in `calendar.py`

2022-01-05 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 2.0 -> 3.0
pull_requests: +28629
pull_request: https://github.com/python/cpython/pull/30424

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46266] Improve day constants (`MONDAY` ... `SUNDAY`) in `calendar.py`

2022-01-05 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

Thanks for the PR.  Sorry that I missed the one public reference in the docs.

--
resolution:  -> fixed
status: open -> closed
versions:  -Python 3.10, Python 3.9

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46266] Improve day constants (`MONDAY` ... `SUNDAY`) in `calendar.py`

2022-01-05 Thread Raymond Hettinger


Raymond Hettinger  added the comment:


New changeset e5894ca8fd05e6a6df1033025b9093b68baa718d by Nikita Sobolev in 
branch 'main':
bpo-46266:  Add calendar day of week constants to __all__  (GH-30412)
https://github.com/python/cpython/commit/e5894ca8fd05e6a6df1033025b9093b68baa718d


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46266] Improve day constants (`MONDAY` ... `SUNDAY`) in `calendar.py`

2022-01-05 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

> The problem is they are documented here:
> https://docs.python.org/3/library/calendar.html#calendar.setfirstweekday

Well, that does make them public, so we have to go forward.

--
resolution: rejected -> 
status: closed -> open

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46266] Improve day constants (`MONDAY` ... `SUNDAY`) in `calendar.py`

2022-01-05 Thread Nikita Sobolev


Nikita Sobolev  added the comment:

> I don't think these were intended to be public.

Thanks for the feedback! The problem is they are documented here: 
https://docs.python.org/3/library/calendar.html#calendar.setfirstweekday

Should we change the docs there to hide them as implementation detail?
Because the current state looks inconsistent to me.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46266] Improve day constants (`MONDAY` ... `SUNDAY`) in `calendar.py`

2022-01-05 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
resolution:  -> rejected
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46266] Improve day constants (`MONDAY` ... `SUNDAY`) in `calendar.py`

2022-01-05 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

I don't think these were intended to be public.  like "January" and "February", 
they were for internal use.  Presumably, this is because the names vary across 
languages.

In the absence of some demonstrated user need, we should leave this alone.

--
assignee:  -> rhettinger
nosy: +rhettinger

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46266] Improve day constants (`MONDAY` ... `SUNDAY`) in `calendar.py`

2022-01-05 Thread Nikita Sobolev


Change by Nikita Sobolev :


--
keywords: +patch
pull_requests: +28618
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/30412

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46266] Improve day constants (`MONDAY` ... `SUNDAY`) in `calendar.py`

2022-01-05 Thread Nikita Sobolev


New submission from Nikita Sobolev :

For some reasons useful day constants (`MONDAY` ... `SUNDAY`) from `calendar` 
are not properly recognised.

Several problems:
0. Not all code inside uses these constants
1. They are not tested. Only `.MONDAY` and `.SUNDAY` are tested to be present 
in 
https://github.com/python/cpython/blob/main/Lib/test/test_calendar.py#L508-L511
2. They are not in `__all__`
3. They are partially documented. There are some notes about them in 
https://docs.python.org/3/library/calendar.html#calendar.setfirstweekday

> Sets the weekday (0 is Monday, 6 is Sunday) to start each week. The values 
> :const:`MONDAY`, :const:`TUESDAY`, :const:`WEDNESDAY`, :const:`THURSDAY`, 
> :const:`FRIDAY`, :const:`SATURDAY`, and :const:`SUNDAY` are provided for 
> convenience. For example, to set the first weekday to Sunday:

>import calendar
>calendar.setfirstweekday(calendar.SUNDAY)

But, they are not clickable, because, for example, ":const:`MONDAY`" does not 
exist in docs index.

So, my plan is:
0. Improve constant usage in the source code to make it more readable
1. Test that constants are there
2. Add them to `__all__` as a part of public API
3. Improve their docs

--
components: Library (Lib)
messages: 409742
nosy: sobolevn
priority: normal
severity: normal
status: open
title: Improve day constants (`MONDAY` ... `SUNDAY`) in `calendar.py`
type: behavior
versions: Python 3.10, Python 3.11, Python 3.9

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com