[Datetime-SIG] Timeline arithmetic?

Alexander Belopolsky alexander.belopolsky at gmail.com
Mon Sep 7 14:50:20 CEST 2015

On Sun, Sep 6, 2015 at 8:19 PM, Carl Meyer <carl at oddbird.net> wrote:

> In this model, there's a bijection between aware
> datetimes in any two timezones. (This model requires the PEP 495 flag,
> or some equivalent.

A nitpick, but since I am also guilty of such loose usage of the term
"bijection", it may be worth a clarification.  We often say that there is a
bijection between two sets when in fact there is only a bijection between a
subset of one set an a subset of another.  In a particular case of aware
datetimes with tzinfo=UTC and tzinfo=Local, a set U = {u ∈ datetime |
u.tzinfo is UTC, u.fold=0} maps to a subset of L= {t ∈ datetime | u.tzinfo
is Local}.  This map creates a bijection between U and its image under the
map, but we are still ignoring the possibility that timezone correction may
take you out of [datetime.min, datetime.max] range.  To rigorously
construct a mathematical bijection - you need to account for those edge
effects as well.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/datetime-sig/attachments/20150907/1334da3d/attachment.html>

More information about the Datetime-SIG mailing list