[Python-ideas] datetime: Support infinity

Antoine Pitrou solipsis at pitrou.net
Wed Jan 28 00:02:09 CET 2015


On Tue, 27 Jan 2015 17:59:13 -0500
Alexander Belopolsky
<alexander.belopolsky at gmail.com> wrote:
> On Tue, Jan 27, 2015 at 5:47 PM, Antoine Pitrou <solipsis at pitrou.net> wrote:
> 
> > > 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.
> 
> 
> I think Antoine meant "timedeltas".

Yup, indeed. My bad.
And for the record:

>>> import numpy as np
>>> np.timedelta64(0) / np.timedelta64(0)
__main__:1: RuntimeWarning: invalid value encountered in true_divide
nan
>>> np.timedelta64(0) / np.timedelta64(0) == np.timedelta64('nat')
True
>>> type(np.timedelta64('nat'))
<class 'numpy.timedelta64'>

Regards

Antoine.




More information about the Python-ideas mailing list