Message277641
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. |
|
Date |
User |
Action |
Args |
2016-09-28 16:16:03 | belopolsky | set | recipients:
+ belopolsky, doerwalter, rhettinger, serhiy.storchaka, xiang.zhang |
2016-09-28 16:16:03 | belopolsky | set | messageid: <1475079363.19.0.472129059986.issue28281@psf.upfronthosting.co.za> |
2016-09-28 16:16:03 | belopolsky | link | issue28281 messages |
2016-09-28 16:16:02 | belopolsky | create | |
|