[Python-ideas] datetime: Support infinity

Antoine Pitrou solipsis at pitrou.net
Tue Jan 27 23:47:12 CET 2015

On Wed, 28 Jan 2015 09:42:16 +1100
Ben Finney <ben+python at benfinney.id.au> wrote:
> Antoine Pitrou <solipsis at pitrou.net>
> writes:
> > Unless someone has a real-world use for the values of date.max,
> > datetime.max, interval.max, I find it rather counter-productive to not
> > store them back as infinities.
> The values are useful to know exactly how far in the future one can
> store date values in Python. It is important that this be discoverable
> programmatically because the maximum 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.

> > Adding infinities to the datetime module would probably be possible but
> > someone has to figure out the arithmetic rules. Do we need "not a time"
> > when adding infinity to -infinity?
> Adding dates (or datetimes) is not a valid operation today, so I don't
> see why we would need to change behaviour there.

We're talking about both datetimes and timestamps here. Please follow.



More information about the Python-ideas mailing list