[Datetime-SIG] naive DateTime, aware DateTime, precise DateTIme

Chris Barker chris.barker at noaa.gov
Thu Jul 30 21:48:56 CEST 2015


On Thu, Jul 30, 2015 at 11:33 AM, Ethan Furman <ethan at stoneleaf.us> wrote:

> Instead of making a new timedelta object, which, after all, represents
> exactly what it says, why don't we make a new DateTime and Time that do the
> duration arithmetic?
>

I like that -- as I read Tim's last post, it struck me that the focus as
been on the timedelta object, but that's not where the confusion is -- you
are right: a timedelta object represents a span of time, in microseconds.
exactly what it says.

The confusion comes in when a timedelta interacts with a datetime and a
tzinfo object.

I'm not sure where in the code the actual logic lies, if it does (or could)
lie with the DurationDateTime object, then that object coulds use the
existing timedelta object for its delta.

On the other hand, a PeriodDateTime object could not use the existing
timedelta object -- as it can only represent an actual time span, and not
something like "months" or "years".

And that would clear up the "what kind of delta to return from subtraction"
issue.

Also -- it would open the door to a different implementation of datetime
and timezones -- i.e. always store UTC, translate to the prescribed time
zone on I/O.

A use case I'm not sure about though -- how often would folks need to do
both kinds of arithmetic on the same datetime objects? If that's a common
use case, it would be a shame to split that objects into different types.

-CHB

-- 

Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

Chris.Barker at noaa.gov
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/datetime-sig/attachments/20150730/4ddca45b/attachment-0001.html>


More information about the Datetime-SIG mailing list