On 7/27/2015 3:09 AM, Tim Peters wrote:
[Paul Moore <p.f.mo...@gmail.com>]
....
As an example, consider an alarm clock. I want it to go off at 7am
each morning. I'd feel completely justified in writing
tomorrows_alarm = todays_alarm + timedelta(days=1).

[Lennart Regebro <rege...@gmail.com>]
That's a calendar operation made with a timedelta.

It's an instance of single-timezone datetime arithmetic, of the
datetime + timedelta form.  Your examples have been of the same form.
Note that after Paul's

      tomorrows_alarm = todays_alarm + timedelta(days=1)

it's guaranteed that

     assert tomorrows_alarm - todays_alarm == timedelta(days=1)

will succeed too.

The "days" attribute here is indeed confusing as it doesn't mean 1 day,
it means 24 hours.

Which, in naive arithmetic, are exactly the same thing.

I think using the word 'naive' is both inaccurate and a mistake. The issue is civil or legal time versus STEM time, where the latter includes applications like baking cakes. It could also be called calendar time versus elapsed time. (Financial/legal arithmetic versus STEM arithmetic is a somewhat similar contrast.)

The idea that an hour can be sliced out of a somewhat random March day and inserting it into a somewhat random October day is rather sophisticated. It came from the minds of government bureaucrats. It might be smart, dumb, or just a cunning way for civil authorities to show who is in charge by making us all jump. But not 'naive'.

'Naive' means simple, primitive, or deficient in informed judgement. It is easy to take it as connoting 'wrong'. Tim, you have been arguing that civil/legal time arithmetic is not naive. Calling civil time naive undercuts this claim.

--
Terry Jan Reedy

_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to