On 04May2020 17:17, ozst...@gmail.com <ozst...@gmail.com> wrote:
On Tuesday, 5 May 2020 01:35:42 UTC+10, David Raymond  wrote:
Not necessarily the cause of your problem, but if you're going to compare dates 
it should be as objects, or as text as year-month-day. Here you're comparing 
dates as text in day-month-year format. So January first 9999 comes before May 
4th 2020

"01-01-9999" < "04-05-2020"
[...]

Thank you, see what you mean. I have corrected this now.

It seem worth pointing out that this is why many of us like ISO8601 dates, which are written from largest component to smallest component. For example:

   2020-05-04

They have the convenient property of sorting lexically as they would sort numerically.

But David's right on in saying that if you're comparing numbers, do it numerically. Comparing text when the underlying thing isn't text is the wrong approach.

Cheers,
Cameron Simpson <c...@cskk.id.au>
--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to