[Datetime-SIG] Are there any "correct" implementations of tzinfo?
tim.peters at gmail.com
Mon Sep 14 22:22:50 CEST 2015
>> It depends on how expensive .utcoffset()
>> is, which in turn depends on how the tzinfo author implements it.
> No, it does not. In most time zones, UTC offset in seconds can be computed
> by C code as a 4-byte integer
Which is a specific implementation of .utcoffset(). Which likely has
nothing to do with how most tzinfo authors will implement _their_
.utcoffset(). For example, look at any tzinfo.utcoffset()
implementation that currently exists ;-)
> than CPython can look up the .utcoffset method. (At least for times
> within a few years around now.) A programmer who makes it slower should
> be fired.
So any programmer who implements .utcoffset() in Python should be
fired? That's the only way I can read that.
> Yet I agree, "'premature optimization' applies at this time."
I'm more worried now about premature firing ;-)
More information about the Python-list