6 Mar
2014
6 Mar
'14
5:05 p.m.
[Alexander Belopolsky
I have to admit that before this discussion, I did not know about the following consequence of the documented behavior:
from datetime import * t = datetime(2014, 1, 1, tzinfo=timezone.utc) tz1 = timezone(timedelta(hours=5)) tz2 = timezone(timedelta(hours=-5)) bool(t.timetz()) False bool(t.astimezone(tz1).timetz()) False bool(t.astimezone(tz2).timetz()) True
I'm not sure I did either! An "aware" time object is a bizarre beast, and I've never used one outside of writing datetime test cases. I'm not even sure why aware time objects exist - we'd have to dig into Guido's subconscious for that one ;-)