In article <mailman.5222.1389232077.18130.python-l...@python.org>, Chris Angelico <ros...@gmail.com> wrote:
> Why not simply use a UTC datetime instead of a naive one? [Pet peeve of mine: uses of "simple" or "just" to imply that something is easy, when it's not. "Why not just get the Arabs and the Jews to be friends?" "Why not simply find a safe way to store nuclear waste?"] Because it's easy to get a naive one. You call datetime.utcnow(). If utcnow() returned an aware datetime, that's probably what we would be using. Why didn't utcnow() just return an aware datetime to begin with? Conversely, it's a pain in the butt to get an aware one. As far as I can tell, you have to do something like: utcnow().replace(tzinfo=pytz.utc) which is not only ugly, but requires installing a third-party module (pytz) to get the UTC timezone definition. Not to mention, our database (mongodb), doesn't support storing aware datetimes. I can insert a document with an aware datetime, but when I retrieve that document, I get back a naive one. I don't know what other databases do. -- https://mail.python.org/mailman/listinfo/python-list