[Python-Dev] Status on PEP-431 Timezones

Lennart Regebro regebro at gmail.com
Wed Apr 8 23:47:45 CEST 2015


On Wed, Apr 8, 2015 at 9:57 PM, Isaac Schwabacher <ischwabacher at wisc.edu> wrote:
> On 15-04-08, Lennart Regebro wrote:
>> === Stdlib option 2: A datetime _is_dst flag ===
>>
>> By having a flag on the datetime instance that says "this is in DST or not"
>> the timezone implementation can be kept simpler.
>
> Storing the offset itself instead of a flag makes things conceptually cleaner.

The concept would be pretty much the same, but yes, you would be able
to save lookups in the dst() call, so that's a benefit. I was planning
on storing the dst() offset at least lazily, but I'm not sure that
means we can get rid of the flag.

> As an added bonus, you get a representation that's still meaningful when time changes happen for political rather than DST reasons.

That's a good point. Although you would still have to use the is_dst
flag to choose in that case, even if neither or both is actually DST.
Unless we come up with another name for that flag, which I don't think
is important.

//Lennart


More information about the Python-Dev mailing list