Path: csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder2.hal-mli.net!news.stack.nl!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.010 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'none,': 0.05; 'activity.': 0.09; 'mess': 0.09; 'referenced': 0.09; 'subject:Why': 0.09; 'subject:not': 0.11; 'assume': 0.11; 'represents': 0.15; 'sat,': 0.15; 'distinction': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'naive': 0.16; 'none).': 0.16; 'roy': 0.16; 'tagged': 0.16; 'timezones': 0.16; 'utc': 0.16; 'utc.': 0.16; 'wrote:': 0.17; 'converted': 0.22; 'header:In-Reply- To:1': 0.25; '(which': 0.26; 'am,': 0.27; 'message- id:@mail.gmail.com': 0.27; 'chris': 0.28; 'piece': 0.29; 'schedules': 0.29; 'figure': 0.30; 'sense': 0.31; 'quotes': 0.33; 'sat': 0.33; 'anyone': 0.33; 'to:addr:python-list': 0.33; 'received:google.com': 0.34; 'server': 0.35; 'whatever': 0.35; 'received:209.85.220': 0.35; 'subject:?': 0.35; 'received:209.85': 0.35; 'but': 0.36; 'data.': 0.36; 'should': 0.36; 'possible': 0.37; 'does': 0.37; 'received:209': 0.37; 'subject:: ': 0.38; 'mean': 0.38; 'some': 0.38; 'to:addr:python.org': 0.39; 'skip:" 10': 0.40; 'stand': 0.61; 'first': 0.61; 'time,': 0.62; 'between': 0.63; 'players': 0.65; 'online': 0.70; 'smith': 0.71; '2013': 0.84; 'usa-based': 0.84; 'fight': 0.97; 'instant': 0.98 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:content-type; bh=oiSJ7pmGO0F8aJedFqQg+HONxwAPrqj+3+8lHPMr8rQ=; b=sGNF7R4nnfjf1cdGyIj0/Avjxh3koCqIb+aMbo3OOWtVCg/fYktmFBWrKR7FBl4Y2F kcB7beWBBQEP9+34mWuLyjd+I7ehZQA5dvXoXcVzCPFp8rt4pxWo45rX3/lkahHAm2lI rEaPW/msrSHOumRJy+yPuAGHVHeIC9cKnffiWHcSos0HxTm4BwddXiBs2KbK2iLilmX1 0QtBF6iVZHh6BZIvmHkIIRQHfbolCBxL2Ac34EWF/uceWnGhxLr2j7Sk9j4bgCMXeujB GVue4rXB3ZeeyYn4LEHx5MjZxt0d8RBO7SGiN65bvr8h8nMSOhDMFZFRxpHII+FL7gnH EQNg== MIME-Version: 1.0 X-Received: by 10.220.218.195 with SMTP id hr3mr2733248vcb.70.1362868112563; Sat, 09 Mar 2013 14:28:32 -0800 (PST) In-Reply-To: References: Date: Sun, 10 Mar 2013 09:28:32 +1100 Subject: Re: Why are timezone aware and naive datetimes not distinct classes? From: Chris Angelico To: python-list@python.org Content-Type: text/plain; charset=ISO-8859-1 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 32 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1362868115 news.xs4all.nl 6858 [2001:888:2000:d::a6]:55580 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:40982 On Sun, Mar 10, 2013 at 6:14 AM, Nobody wrote: > On Sat, 09 Mar 2013 09:01:17 +1100, Chris Angelico wrote: > >> As I see it, a naive datetime simply does not have a timezone. > > The distinction between aware and naive isn't whether the .tzinfo member > is None, but whether self.utcoffset() returns None (which can occur either > if self.tzinfo is None or if self.tzinfo.utcoffset(self) returns None). > > IOW, an "aware" time/datetime can be converted to a UTC time/datetime, a > "naive" one can't, although it can still have a timezone which isn't > referenced to UTC. I stand corrected. Though the distinction I made in my first paragraph is still valid: an aware datetime represents an instant in time, a naive one is a tagged piece of arbitrary data. On Sun, Mar 10, 2013 at 6:40 AM, Roy Smith wrote: > Future scheduled activities (which I assume is what you > mean by "appointments") should be kept in whatever timezone makes sense > for that activity. Agreed; and in some specific circumstances, it's even possible to fight the whole mess of timezones. My online Dungeons and Dragons group schedules everything on UTC - for example, the server quotes the current time as Sat 22:26, and I have a session at Sun 02:00, so anyone can figure out how long until session without worrying about timezones or Daylight Robbery Time. Of course, that _does_ come at a cost; mainly it's the USA-based players who get confused (which surprises me somewhat, tbh). ChrisA