Implement C's Switch in Python 3

Avi Gross avigross at verizon.net
Sun Feb 3 18:52:14 EST 2019


Comment at end:

-----Original Message-----
From: Python-list <python-list-bounces+avigross=verizon.net at python.org> On Behalf Of Bob van der Poel
Sent: Sunday, February 3, 2019 4:01 PM
To: DL Neil <PythonList at danceswithmice.info>
Cc: Python <python-list at python.org>
Subject: Re: Implement C's Switch in Python 3

<Snip€>

I'm surprised that no one has yet addressed the year 10000 problem.
Hopefully we're doing numeric, not alpha sorts on the stuff before the 1st '-'. And, the compact versions will really screw up :).

[[The obvious solution is to list all dates in the sortable format like this for January 2nd, 2020:

0Q20200102

Without the 0Q we might just assume it was written in base 3, or trinary.

OK, turning sarcasm mode off.

It is very bad form to have ambiguous compressed formats. Even if you include a slash or minus sign or period or the delimiter of your choice, I sometimes see this:

01/02/2020

And I wonder if it is meant to be January 2nd or February 1st.

Clearly 30/01/2020 cannot be the 30th month so it must be an alternate format. And, years from now, we may get a year that might confuse us more if compressed like:

21121221

Is that 2112 as the year an Dec 21? 

In the interest of clarity,  how is this different than including a time zone alongside a time value? Maybe '0Q" is silly, but a prefix or suffix or even a new delimiter might be a good idea. Are any available?

2020|12|02 ???

The end]]




More information about the Python-list mailing list