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


Groups > comp.lang.python > #40982

Re: Why are timezone aware and naive datetimes not distinct classes?

References <roy-3BFD51.13412708032013@70-1-84-166.pools.spcsdns.net> <pan.2013.03.08.21.33.44.615000@nowhere.com> <mailman.3104.1362780081.2939.python-list@python.org> <pan.2013.03.09.19.14.59.699000@nowhere.com>
Date 2013-03-10 09:28 +1100
Subject Re: Why are timezone aware and naive datetimes not distinct classes?
From Chris Angelico <rosuav@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.3141.1362868115.2939.python-list@python.org> (permalink)

Show all headers | View raw


On Sun, Mar 10, 2013 at 6:14 AM, Nobody <nobody@nowhere.com> 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 <roy@panix.com> 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

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


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