On Tue, Aug 18, 2015 at 11:07 AM, Guido van Rossum <[email protected]> wrote:
> PEP 500 allows way more freedom than is needed.

This is right.  With respect to finding elapsed time between two times
(x and y) expressed as datetime instances, PEP-0500 allow tzinfo
implementor to provide an arbitrary function of two variables: d(x,
y), while arguably in most cases d(x, y) = x - f(x) - y + f(y), where
f is a function of a single variable.  (In terms of current tzinfo
interface, f is the utcoffset() function.)  In other words, the PEP
allows arbitrary stretching and shrinking of the time line, while in
most use cases only cutting and shifting is needed.

However, I don't see this additional freedom as a big complication.
Even in the common case, it may be easier to implement d(x, y) than to
figure out f(x).  The problem with f(x) is that it is the UTC offset
as a function of local time while most TZ database interfaces only
provide UTC offset as a function of UTC time.  As a result, it is
often easier to implement d(x, y) (for example, as d(x, y) = g(x) -
g(y)) than to implement f(x).
_______________________________________________
Datetime-SIG mailing list
[email protected]
https://mail.python.org/mailman/listinfo/datetime-sig
The PSF Code of Conduct applies to this mailing list: 
https://www.python.org/psf/codeofconduct/

Reply via email to