Implement C's Switch in Python 3

Chris Angelico rosuav at gmail.com
Sun Feb 3 16:15:03 EST 2019


On Mon, Feb 4, 2019 at 8:02 AM Bob van der Poel <bob at mellowood.ca> wrote:
>
> 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 :).
>

Compact versions? You mean non-delimited dates? They sort just fine numerically:

20190204
99991231
100000101

They also sort just fine if you add a two-digit serial number:

2017081702
2017120801
2019011300

and while it's true that this format will overflow in two thousand
years if stored in a 32-bit number, it's fine for arbitrary future
dates if stored in bignums.

ChrisA



More information about the Python-list mailing list