[Chris Angelico <ros...@gmail.com>]
> What I'd like to hear (but maybe this won't be possible) would be
> "less-than is transitive if and only if <X>", where <X> might be
> something like "all of the datetimes are in the same timezone" or
> "none of the datetimes fall within a fold" or something. That would at
> least make sorting possible, but maybe with a first-pass check to
> ensure transitivity.
>
> Vain hope or plausible restriction?

Pragmatically, if someone needs to care about sorting aware datetimes
that may include times in folds, the obvious way is to convert them to
UTC first (which can be done with sort's `key=` argument).  Times in
UTC are totally ordered (essentially the same as working with
integers).

That's a sane & easy sufficient condition.  It's a waste of time to
worry about minimal necessary conditions.  "Convert to UTC' is the
obvious way to do darned near everything.  Converting to any other
fixed-offset zone would do just as well, but _that_ observation is
also a waste of time, since "convert to UTC" is just as easy ;-)
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to