On Thu, Mar 6, 2014 at 12:08 PM, Nick Coghlan
Now, let's consider the time with the *best* possible claim to being false: timestamp zero. How does that behave?
[... snipped ...]
So, unless I happen to live in UTC, it's highly unlikely that I'm going to infer from Python's *behaviour* that datetime.time() (unlike datetime.date() and datetime.datetime()) belong in the "number" category, rather than the "arbitrary object" category.
This one's even *more* fun if you live in the UK. I live on the Greenwich Meridian (and I mean that quite literally: it goes through the middle of my living room), and since the epoch was in January, well away from British Summer Time, I shouldn't see any of those pesky timezone-related problems that those poor underprivileged people living in non-UTC timezones see. Right? Here's Python 2.7 on my Mac laptop, whose timezone is set to London time:
import datetime as dt bool(dt.datetime.fromtimestamp(0).time()) True
And on Windows (again with timezone set to the UK):
import datetime as dt bool(dt.datetime.fromtimestamp(0).time()) False
Wait, what? It turns out that in January 1970, the UK government was in the middle of an experimental change to a year-round GMT+1 timezone. Some operating systems seem to be aware of that fact; some aren't. Count me in the bool(time(0)) should be True camp, by the way. -- Mark