On Wed, Jan 28, 2015 at 6:55 PM, Yawar Amin <yawar.amin@gmail.com> wrote:Cool, the comparison operator logic looks very similar to mine:
https://groups.google.com/d/msg/python-ideas/G3jeWoa6h14/ELpDLFu28QcJ
Did you get it to work both ways? i.e.datetime.neg_inf < datetime.now()and
datetime.now() > datetime.neg_infI had trouble with that, because the regular datetime doesn't know how to compare itself to a neg_inf object.
I believe the ideal design is the following type hierarchy:
datetime_base
datetime_neg_inf
datetime_pos_inf
datetime
But in the interests of pragmatism, I think this one can be made to
work:
datetime
datetime_neg_inf
datetime_pos_infyup -- should work.and you could add class methods to the datetime object, so you could do:datetime.neg_inf()anddatetime.pos_inf()Theadvantage to this is that we don't have to switch everything over to
using a new derived type--just use the normal datetime for the majority
of cases where we don't need inifinity dates.And it could be a third part package, too. -- particularly good for backward compatibility.-Chris
--
Christopher Barker, Ph.D.
Oceanographer
Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
Chris.Barker@noaa.gov