[Python-ideas] datetime: Support infinity

Ben Finney ben+python at benfinney.id.au
Wed Jan 28 00:02:47 CET 2015


Antoine Pitrou <solipsis at pitrou.net>
writes:

> On Wed, 28 Jan 2015 09:42:16 +1100
> Ben Finney <ben+python at benfinney.id.au> wrote:
> > The [minimum and maximum] values are useful to know exactly how far
> > in the future [and past] one can store date values in Python. It is
> > important that this be discoverable programmatically because the
> > maximum [or minimum] values might change in future versions of the
> > ‘datetime’ library.
>
> So what? Again, the values wouldn't change in Python. It would only be
> the PostgreSQL mapping that would change.

That's the point, though. We should at least allow for “datetime.date.max”
and “datetime.date.infinitely_far_in_the_future” to be distinct, and
allow for the former to change value in a backward-compatible way.

So the maxima and minima should map to their specific points in time in
both directions between PostgreSQL and Python.

“Maximum” does not mean “infinite”, and conflating them robs us not only
of the backward-compatible ability to change the maximum in future, but
also of the ability to later add a distinct value to represent infinity.

-- 
 \     “You don't need a book of any description to help you have some |
  `\    kind of moral awareness.” —Dr. Francesca Stavrakoloulou, bible |
_o__)                                              scholar, 2011-05-08 |
Ben Finney



More information about the Python-ideas mailing list