git.net

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Implement C's Switch in Python 3


On Sun, Feb 3, 2019 at 2:15 PM Chris Angelico <rosuav at gmail.com> wrote:

> 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.
>

Yes,

99991231
100000101

will wort properly if numeric. But, if we use the ISO recommended

9999-12-31
10000-01-01

then we'd most likely do an alpha sort ... opps, you're right! That works
fine as well. Guess there is no year 10000 problem :)

-- 

**** Listen to my FREE CD at http://www.mellowood.ca/music/cedars ****
Bob van der Poel ** Wynndel, British Columbia, CANADA **
EMAIL: bob at mellowood.ca
WWW:   http://www.mellowood.ca