This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Change datetime.MINYEAR to allow for negative years
Type: enhancement Stage: resolved
Components: Library (Lib) Versions: Python 3.9
process
Status: closed Resolution: rejected
Dependencies: Superseder:
Assigned To: Nosy List: Sam Wainwright, belopolsky, p-ganssle, tim.peters
Priority: normal Keywords:

Created on 2019-08-31 01:20 by Sam Wainwright, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Messages (3)
msg350904 - (view) Author: Sam Wainwright (Sam Wainwright) Date: 2019-08-31 01:21
The value of datetime.MINYEAR (1) seems arbitrarily restrictive. There are plenty of reasons why users of the standard library might want to work with negative years. Workarounds involving things like astropy don't work in all cases, particularly when you're working with other third-party libraries that use python dates internally and forking them is a hassle.
msg350929 - (view) Author: Paul Ganssle (p-ganssle) * (Python committer) Date: 2019-08-31 20:56
This is only a semi-arbitrary restriction. Realistically, `datetime` is not a particularly good way to represent times much older than the 17th or 18th century (and if you're using time zones, it gets increasingly inaccurate as you go further back from 1970 or the further in the future you go from the current time). Generally, I think the choice to keep it to positive dates is due to a combination of the fact that 1. it introduces a lot more edge cases (there's no year 0, for example) 2. it may invalidate otherwise perfectly acceptable assumptions that people have made in code about the sign of the component values and 3. it would be a rarely used feature of dubious utility. I am not sure that adding this feature would be worth the support burden it would bring.

There was a discussion about this on the discourse in the past, there wasn't an obvious consensus that it would never happen, but I would not say that there was much support for the idea: https://discuss.python.org/t/bc-date-support/582/2
msg350931 - (view) Author: Tim Peters (tim.peters) * (Python committer) Date: 2019-08-31 21:19
This just isn't going to happen.  There's no agreement to be had.  For example, the proleptic Gregorian calendar _does_ have a "year 0", and so also does ISO 8601.

Version 1.0 of the XML schema spec did not have a year 0, but _claimed_ to be compatible with ISO 8601 - which it wasn't in this respect.  So version 1.1 added year 0, despite then being incompatible with version 1.0 of itself in this respect[1].

> I am not sure that adding this feature would be worth
> the support burden it would bring.

I am:  it wouldn't ;-)  

[1] https://en.wikipedia.org/wiki/Astronomical_year_numbering
History
Date User Action Args
2022-04-11 14:59:19adminsetgithub: 82173
2019-09-06 22:01:49terry.reedysetstatus: open -> closed
stage: resolved
resolution: rejected
versions: + Python 3.9, - Python 3.7
2019-08-31 21:19:53tim.peterssetnosy: + tim.peters
messages: + msg350931
2019-08-31 20:56:41p-gansslesetmessages: + msg350929
2019-08-31 12:24:54xtreaksetnosy: + belopolsky, p-ganssle
2019-08-31 01:21:51Sam Wainwrightsetmessages: + msg350904
2019-08-31 01:20:47Sam Wainwrightcreate