[Python-Dev] datetime +/- scalars (int, long, float)?

Guido van Rossum guido@python.org
Mon, 04 Mar 2002 09:02:28 -0500


[MAL]
> > > You should name the type timestamp if you want to imply dt + n
> > > == dt + n seconds. datetime + n is commonly understood as
> > > dt + n *days*.
> [...] 

[me]
> > Is this just an mxDateTime convention, or is it in wider use?  (URLs
> > of docs of other languages / libraries would really help to convince
> > me!)

[Kevin]
> I'm afraid that this really is the de-facto standard.

Then I propose to remove the feature of automatic mixing
int/long/float and datetime or timedelta instances in add/subtract
operations.  You'll have to specify what you want using a
timedelta(days, seconds) constructor.  That's clearer anyway.

> However, lets be clear; is t=t+1 adding 1 (calendar) day or 24 hours
> (86400 seconds)?

How does it differ?  (We already ignore leap seconds.)

--Guido van Rossum (home page: http://www.python.org/~guido/)