Opened 7 years ago
Closed 7 years ago
#28798 closed Cleanup/optimization (fixed)
Remove unused django.utils.dates.WEEKDAYS_REV, MONTHS_3_REV
Reported by: | Chris Lamb | Owned by: | nobody |
---|---|---|---|
Component: | Utilities | Version: | 2.0 |
Severity: | Normal | Keywords: | dates |
Cc: | Triage Stage: | Ready for checkin | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
We have no MONTHS_REV
despite having MONTHS
whilst we have WEEKDAYS
and its reverse WEEKDAYS_REV
, as well as MONTHS_3
and MONTHS_3_REV
.
Change History (12)
comment:1 by , 7 years ago
Has patch: | set |
---|---|
Needs tests: | set |
follow-up: 3 comment:2 by , 7 years ago
Type: | Uncategorized → Cleanup/optimization |
---|
MONTHS_3_REV
and WEEKDAYS_REV
have been in Django since the first commit ("Imported Django from private SVN repository"), but they've never been used. I'd be more inclined to remove them than to add another unused dictionary. Have you found many projects using these dicts?
comment:3 by , 7 years ago
Replying to Tim Graham:
Have you found many projects using these dicts?
I find myself reaching for them fairly often, particulary when making a custom-ish date dropdown or some (admittedly trivial) parsing.
follow-up: 5 comment:4 by , 7 years ago
I also wonder if these dictionaries merit a continued presence because they are English-centric. I didn't find any usage of them in a GitHub code search.
comment:5 by , 7 years ago
Replying to Tim Graham:
I also wonder if these dictionaries merit a continued presence because they are English-centric. I didn't find any usage of them in a GitHub code search.
That's a fair comment. Shall we just remove the entire file? I'd prefer it "complete" or gone, really :)
follow-up: 7 comment:6 by , 7 years ago
Only the _REV
suffixed dictionaries are unused. My thinking is to remove them. django/utils/dateformat.py
uses the other variables.
comment:7 by , 7 years ago
Replying to Tim Graham:
Only the
_REV
suffixed dictionaries are unused. My thinking is to remove them.django/utils/dateformat.py
uses the other variables.
Ahhh, my bad. Well, in that case I'd err in terms of completing it (ie. applying this patch).
comment:8 by , 7 years ago
Usually we've removed things in django.utils
once Django no longer uses it. Offhand, I can't think of something in there that Django doesn't use.
comment:9 by , 7 years ago
Cool, so in summary, we have three paths forward:
a) Remove the unused _REV
b) Complete the set.
c) No action.
You seem to be in favour of "a", I'm leaning towards "b". I'm easy with either - let me know which you would like and I'll go ahead and update the PR/whatever. :)
comment:10 by , 7 years ago
I'd favour "a", too, unless we find a general-enough use case to demonstrate their utility.
comment:11 by , 7 years ago
Needs tests: | unset |
---|---|
Summary: | Add a MONTHS_REV dict to match WEEKDAYS/WEEKDAYS_REV & MONTHS_3/MONTHS_3_REV → Remove unused django.utils.dates.WEEKDAYS_REV, MONTHS_3_REV |
Triage Stage: | Unreviewed → Ready for checkin |
PR: https://github.com/django/django/pull/9355