[Datetime-SIG] PEP 495: Local time disambiguation

Alexander Belopolsky alexander.belopolsky at gmail.com
Sat Aug 8 05:38:51 CEST 2015

I am close enough to finalizing PEP 495 and its reference
implementation, that it is time to have some bikeshedding fun and pick
the name for the new flag.

On Thu, Jul 30, 2015 at 1:46 PM, Alexander Walters
<tritium-list at sdamon.com> wrote:
> '.first' also makes the default 'True', and it might just be me, but I don't
> like that aesthetically.

This is a valid concern and even short experience with datetime.first
shows that in the most cases the needed value is (not first).

In the early versions of my proposal, I was using a "which" variable
with values 0 or 1 as some sort of index into the ordered list of UTC
times that correspond to the ambiguous local time, but I soon realized
that which=0 or which=1 are devoid of any mnemonic meaning.  I also
wanted to have a true boolean flag with a meaningful name.  The best I
could come up with was time(1, 30, first=True) to stand for the "first
01:30" and time(1, 30, first=False) to stand for the "second (not
first) 01:30".

I did want to have a flag with the opposite meaning, but for obvious
reasons, we cannot have a flag called "second".  I also rejected
"later" because I can never remember when to use "later" and when
"latter" and since either of those words could be used as the name of
the disambiguation flag, using either of them would be a disservice to
our users.

After I published the first draft of the PEP, I realized that the
second of the two ambiguous hours can also be called "repeated."  As I
am writing this, I really have no objections to time(1, 30,
repeated=True) spelling for the "second 01:30" other than having to
make several dozen changes to the PEP and to the implementation code.

If I have to make a name change, I would really like to make it only
once.  So if you hate the first=True default - speak now or forever
hold your peace.

More information about the Datetime-SIG mailing list