Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #24951
| From | Damjan <gdamjan@gmail.com> |
|---|---|
| Subject | Re: Confusing datetime.datetime |
| Date | 2012-07-06 04:05 +0200 |
| References | <jt4766$og9$1@dough.gmane.org> <mailman.1843.1341528901.4697.python-list@python.org> <4ff63f58$0$29988$c3e8da3$5496439d@news.astraweb.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.1844.1341540292.4697.python-list@python.org> (permalink) |
> from datetime import datetime, timedelta, tzinfo > ZERO = timedelta(0) > HOUR = timedelta(hours=1) > > class UTC(tzinfo): > def utcoffset(self, dt): > return ZERO > def tzname(self, dt): > return "UTC" > def dst(self, dt): > return ZERO > > utc = UTC() > t1 = datetime.now(tz=utc) > t2 = datetime(t1.year, t1.month, t1.day, tzinfo=utc) > assert t1.tzinfo == t2.tzinfo > > > No assertion error at all. > > This makes me think that the "retardation" as you put it is not in > Python's datetime module at all, but in pytz. > > What does TZ == TZ give? If it returns False, I recommend you report it > as a bug against the pytz module. It returns True, so it seems to be changed in the datetime object?? I tried both 2.7 and 3.2 -- damjan
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Re: Confusing datetime.datetime Damjan <gdamjan@gmail.com> - 2012-07-06 00:55 +0200
Re: Confusing datetime.datetime Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-07-06 01:28 +0000
Re: Confusing datetime.datetime Damjan <gdamjan@gmail.com> - 2012-07-06 04:05 +0200
Re: Confusing datetime.datetime Hans Mulder <hansmu@xs4all.nl> - 2012-07-06 18:41 +0200
Re: Confusing datetime.datetime Damjan <gdamjan@gmail.com> - 2012-07-08 23:49 +0200
csiph-web