Guido van Rossum wrote:
Hope you don't mind ;-) ...
Not at all, we're hoping to arrive at something usable and fun for all!
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*.
Hm, I hadn't thought of that. To me seconds are the only thing that makes sense because that's what a Unix timestamp does, but I haven't read or written a lot of commercial code using date/time data.
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!)
I'm not sure how wide-spread this convention is, but the mxDateTime users pushed me to it, so there must be some general understanding in that direction out there ;-)
In mxDateTime I use the following conventions:
DateTime + n: add n days (each having 86400.0 seconds, so fractions are possible too)
DateTimeDelta + n: add n seconds
It is of course prevered to write:
DateTime(...) + DateTimeDelta(...) or DateTime(...) + RelativeDateTime(...)
since this is more exlicit. There are also a few constants to make this even easier:
DateTime(...) + 10 * oneSecond - 20 * oneMinute