[Python-Dev] Checking input range in time.asctime and time.ctime

Alexander Belopolsky alexander.belopolsky at gmail.com
Wed Jan 5 19:12:38 CET 2011

On Wed, Jan 5, 2011 at 12:48 PM, Antoine Pitrou <solipsis at pitrou.net> wrote:
> Couldn't we deprecate and remove time.accept2dyear? It has been there
> for "backward compatibility" since Python 1.5.2.

It will be useful for another 50 years or so.  (POSIX 2-digit years
cover 1969 - 2068.)  In any case, this is not an option for 3.2 while
extending accepted range is a borderline case IMO.

> Not to mention that global settings affecting behaviour are generally
> bad, since multiple libraries could have conflicting expectations about
> it. And parsing times and dates is the kind of thing that a library
> will often rely on.

Yes, for 3.3 I am going to propose an optional accept2dyear argument
to time.{asctime, strftime} in addition to or instead of a global
variable.  This is also necessary to implement a pure python version
of datetime.strftime that would support full range of datetime.  See
http://bugs.python.org/issue1777412 .

More information about the Python-Dev mailing list