[Python-ideas] datetime: Support infinity
solipsis at pitrou.net
Mon Jan 26 10:14:23 CET 2015
On Mon, 26 Jan 2015 09:24:07 +0100
<guettliml at thomas-guettler.de> wrote:
> postgreSQL supports infinity for datetime:
> infinity date, timestamp later than all other time stamps
> -infinity date, timestamp earlier than all other time stamps
> Mapping this to python is not possible at the moment.
> PostgreSQL can store the representation of an “infinite” date, timestamp, or interval. Infinite dates are not available
> to Python, so these objects are mapped to date.max, datetime.max, interval.max. Unfortunately the mapping cannot be
> bidirectional so these dates will be stored back into the database with their values, such as 9999-12-31.
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.
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?
More information about the Python-ideas