PEP 615: Support for the IANA Time Zone Database in the Standard Library

My concern was about loading the same zone by two different means and get not identical objects (zone1 is not zone2) but equal transition data (what I wrote as “zone1 == zone2”).

The problem is that defining the equal operator opens a can of worms. For me, Europe/Paris and Europe/Brussels are the same because they have the same UTC offset today. But Europe has a long history, and France and Belgium didn’t always have the same time (I didn’t check, but I’m quite sure that these neighbors had different time a few days since 1900).

So yeah, I understand that a new “equivalent_transitions()” function or method should be designed to take in account what the user “expects”. It’s also ok to leave this problem out of the stdlib for now. For example, I can put such code in my application:

def same_utfoffset_now(zone1, zone2):
    now = datetime.datetime.now()
    return (zone1.utcoffset(now) == zone2.utcoffset(now))

Let’s start simple with the uncontroversial part and complete the API later :wink:

1 Like