Alexander Belopolsky added the comment:

The proposed interpretation of nonpositive years is not arbitrary, it is a 
natural extension of the same formulas that we use for positive years.  On the 
other hand 1-9999 limits are arbitrary.  If we wanted to restrict calendars to 
4-digit years we would limit years to the 1000-9999 range.

Note that interpreting year 0 as 1 BCE is not without a precedent.  ISO 8601 
standard does exactly that with the caveat that "values in the range [0000] 
through [1582] shall only be used by mutual agreement of the partners in 
information interchange." Furthermore, "an expanded year representation 
[±YYYYY] must have an agreed-upon number of extra year digits beyond the 
four-digit minimum, and it must be prefixed with a + or − sign instead of the 
more common AD/BC (or BCE/CE) notation; by convention 1 BC is labelled +0000, 2 
BC is labeled -0001, and so on."  See 
<https://en.wikipedia.org/wiki/ISO_8601#Years> citing ISO 8601:2004 sections 
3.4.2, 4.1.2.4 and Annex B.1.1.

Furthermore, documenting the existing limits is not an easy task.  For example

>>> from calendar import *
>>> cal = TextCalendar(1)
>>> cal.prmonth(1, 1)
     January 1
Tu We Th Fr Sa Su Mo
                   1
 2  3  4  5  6  7  8
 9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31

displays 6 days in December of 1 BCE as blanks.  Similarly itermonthdays() and 
itermonthdays2() generators yield objects corresponding to these days.  Are 
these days within the calendar limits or not?

Note that I am not proposing to extend the range of the datetime.date objects.  
Doing that would be a much more difficult task, but defining calendars for out 
of range years as those for year % 400 is trivial and much easier than to 
figure out and document the edge behaviors.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue28281>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to