[Datetime-SIG] PEP-0500 (Alternative datetime arithmetic) Was: PEP 495 ... is ready ...

Tim Peters tim.peters at gmail.com
Tue Aug 18 03:22:18 CEST 2015

> Well, everyone implementing a tzinfo class will be confronted with the
> question whether to provide those special methods or not. And they may well
> be copy/pasting code that implements them. So my claim is that this makes
> the life of everyone implementing a tzinfo a little more complex, not just
> that of tzinfo implementers who actually need this protocol. Just like the
> mere existence of __length_hint__ serves as a distraction for anyone
> implementing an iterator.

Seriously:  who writes tzinfo classes?  I do, but I don't personally
give a rip about any form of timeline arithmetic.  Who writes
iterators?  A better question for _that_ is "who doesn't?" ;-)

AFAICT, only two people in over a dozen years have been serious tzinfo
authors, and every serious I project I ever heard of uses one of their
two packages:

- Stuart Bishop, whose pytz wraps the Olson database, plus endures
enormous pain to disambiguate folds.

- Gustavo Niemeyer, whose dateutil wraps all of (at least) the Olson
database, POSIX TZ strings, Windows registry timezones, and
iCalendar-style VTIMEZONE files.

Am I missing any?

If not, who are we concerned about?  I'm pretty sure Stuart and
Gustavo have amply demonstrated they're capable of dealing with things
dozens of times more complex than anything discussed here.  Nobody
else cares:  they just grab a package and use it.  That's how it
should be.  If and when canned timezones are supplied with Python, one
person in the core may still care - plus, of course, people highly
motivated to do things the core doesn't cater to.

> ...
> That's a straw man, right? The stock markets closed around the leap second
> because they can't deal with this.

Just because I know everyone is fascinated by this ;-) , do note that
there are many financial markets around the world, and they no more
agree on what to do than anyone else does.  Examples for _this_ round
of leap second include:

- NASDAQ closed for the day early.

- Many Asian markets opened late.

- Many global exchanges shut down before the leap second insertion and
opened again after the next hour passed.

- Brazilian markets added their leap second two days early, on Sunday
when Brazil's markets were closed.  They remained open across "the
real" leap second insertion (which their computers' time services were
fiddled to ignore).

- Some markets ignored the potential problems entirely and just keep going.

I don't know whether any problems occurred this time.  "The news" is
great at publicizing pre-event hysteria, but poor on following up.

More information about the Datetime-SIG mailing list