Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #24951

Re: Confusing datetime.datetime

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!ecngs!feeder2.ecngs.de!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.001
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'true,': 0.04; 'false,': 0.07; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'bug': 0.10; 'def': 0.10; '2.7': 0.13; 'message-id:@dough.gmane.org': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'utc': 0.16; 'module': 0.19; 'all,': 0.21; 'import': 0.21; '3.2': 0.22; "python's": 0.23; 'seems': 0.23; 'tried': 0.25; 'header:In- Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'module.': 0.27; 'subject:skip:d 10': 0.27; 'header:X-Complaints-To:1': 0.28; 'all.': 0.28; 'assert': 0.29; 'class': 0.29; 'error': 0.30; 'zero': 0.33; 'to:addr:python-list': 0.33; 'skip:d 20': 0.34; 'changed': 0.34; 'received:org': 0.36; 'but': 0.36; 'does': 0.37; 'subject:: ': 0.38; 'to:addr:python.org': 0.39; 'skip:" 10': 0.40; 'header:Received:5': 0.40; 'think': 0.40; 'skip:u 10': 0.60; 'hour': 0.69; 'received:89': 0.86
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Damjan <gdamjan@gmail.com>
Subject Re: Confusing datetime.datetime
Date Fri, 06 Jul 2012 04:05:38 +0200
References <jt4766$og9$1@dough.gmane.org> <mailman.1843.1341528901.4697.python-list@python.org> <4ff63f58$0$29988$c3e8da3$5496439d@news.astraweb.com>
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding 7bit
X-Gmane-NNTP-Posting-Host 89.205.110.217
User-Agent Mozilla/5.0 (X11; Linux i686; rv:13.0) Gecko/20120616 Thunderbird/13.0.1
In-Reply-To <4ff63f58$0$29988$c3e8da3$5496439d@news.astraweb.com>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.1844.1341540292.4697.python-list@python.org> (permalink)
Lines 33
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1341540292 news.xs4all.nl 6910 [2001:888:2000:d::a6]:44461
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:24951

Show key headers only | View raw


> 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 | NextPrevious in thread | Next in thread | Find similar | Unroll thread


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