[Python-ideas] datetime: Support infinity

Yawar Amin yawar.amin at gmail.com
Thu Jan 29 03:55:58 CET 2015


On 2015-01-28 00:17, Chris Barker wrote:
> [...]
> Sure, here you go:
>
> https://github.com/NOAA-ORR-ERD/PyGnome/blob/master/py_gnome/gnome/utilities/inf_datetime.py

Cool, the comparison operator logic looks very similar to mine:

https://groups.google.com/d/msg/python-ideas/G3jeWoa6h14/ELpDLFu28QcJ

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_inf

So we'd keep using the existing datetime type, and whenever we need
infinity datetimes we'd just pass in the appropriate subtypes. The
advantage 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.

Regards,

Yawar


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 834 bytes
Desc: OpenPGP digital signature
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20150128/4e318ecf/attachment.sig>


More information about the Python-ideas mailing list