Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #41081
| Subject | Re: Why are timezone aware and naive datetimes not distinct classes? |
|---|---|
| From | Adam Tauno Williams <awilliam@whitemice.org> |
| Date | 2013-03-11 13:27 -0400 |
| References | <roy-3BFD51.13412708032013@70-1-84-166.pools.spcsdns.net> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.3199.1363024033.2939.python-list@python.org> (permalink) |
On Fri, 2013-03-08 at 13:41 -0500, Roy Smith wrote: > To make a long (and painful) story short, I've got a (large) list of > datetimes, and was getting some bizarre errors working with it. One of > the things I tried while debugging the problem was verifying that all > the elements of the list were indeed datetimes: > In [59]: set(type(foo) for foo in x) > Out[59]: set([datetime.datetime] Because date/time management in Python is *@*&@R&*(R *@&Y terrible! Period, full-stop, awful, crappy, lousy, and aggravating. The design is haphazard and error inducing. Pass through the list once and convert them all the UTC [or I suppose, make them all naive]. BTW, this page is a life and sanity saver: <http://taaviburns.ca/what_you_need_to_know_about_datetimes/datetime_transforms.html> And one of my own tricks is posted here: <http://www.whitemiceconsulting.com/2012/10/setting-course-for-utc.html> > Well, it turns out, one of them was a timezone-aware datetime, and all > the others were naive! I finally figured it out when I tried Welcome! -- Adam Tauno Williams GPG D95ED383 Systems Administrator, Python Developer, LPI / NCLA
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Why are timezone aware and naive datetimes not distinct classes? Roy Smith <roy@panix.com> - 2013-03-08 13:41 -0500
Re: Why are timezone aware and naive datetimes not distinct classes? Nobody <nobody@nowhere.com> - 2013-03-08 21:33 +0000
Re: Why are timezone aware and naive datetimes not distinct classes? Chris Angelico <rosuav@gmail.com> - 2013-03-09 09:01 +1100
Re: Why are timezone aware and naive datetimes not distinct classes? Nobody <nobody@nowhere.com> - 2013-03-09 19:14 +0000
Re: Why are timezone aware and naive datetimes not distinct classes? Roy Smith <roy@panix.com> - 2013-03-09 14:40 -0500
Re: Why are timezone aware and naive datetimes not distinct classes? Nobody <nobody@nowhere.com> - 2013-03-09 23:38 +0000
Re: Why are timezone aware and naive datetimes not distinct classes? Chris Angelico <rosuav@gmail.com> - 2013-03-10 09:28 +1100
Re: Why are timezone aware and naive datetimes not distinct classes? Adam Tauno Williams <awilliam@whitemice.org> - 2013-03-11 13:27 -0400
Re: Why are timezone aware and naive datetimes not distinct classes? djc <djc@kangoo.invalid> - 2013-03-11 20:32 +0000
csiph-web