This story is unavailable.

Bang on!

I’d say there’s another systematic issue, one I’d forgotten until the other day when I had to explain this to someone else, and that’s that the whole functionality of time is weirdly and inconsistently striped across two modules, time and datetime — modules which are partly “clever Python code” and partly “awkward wrappers around C library facilities”.

One of the things that I like to do to see if I’m as smart as I think I am is to predict the results of something I should know:

import time, datetime
print(time.time(), datetime.time())

In this case, I was not so smart! Even though I’ve made some use of both of these modules in the last few months, I got both values wrong before actually trying them out.

As we all know, times are difficult for programmers to reason with (just like email addresses, postal addresses and, to a lesser extent, phone numbers). It’s understandable that Python 2.x didn’t do an excellent job on this — but it’s regrettable that when they had the opportunity with Python 3, the Python people didn’t take the chance to fix it all up.

Now I’m all Cythoned up, I have toyed with the idea of writing a proper date and time handling Python extension — but I suspect that it’d be a lot of work, that supporting it would be ten times the work, and I’d get little out of it except a lot of thankful programmers.

Show your support

Clapping shows how much you appreciated Tom Ritchford’s story.