[Datetime-SIG] Datetime arithmetic proposal

Alexander Belopolsky alexander.belopolsky at gmail.com
Wed Jul 29 04:33:43 CEST 2015


On Tue, Jul 28, 2015 at 10:24 PM, Tim Peters <tim.peters at gmail.com> wrote:
> [Chris Barker <chris.barker at noaa.gov>]
>> what the heck would that mean? the timedeltas already do that -- what they
>> don't do is calendar maniplutaions -- things like "this same time tomorrow"
>> -- or tomorrow morning at 7:00am.
>
> We've been through this before, and it's been discussed literally
> dozens of times on python-dev recently.  So I refuse to use any "word
> salad" to try to describe anything anymore - nobody can hear anything
> anyone else says ;-)

Maybe the following session log (ran from the root of the source
distribution) will
get the message across:

>>> with open('Doc/includes/tzinfo-examples.py') as f:
...     exec(f.read())
...
>>> t = datetime(2014,11,1,12,tzinfo=Eastern)
>>> t.strftime('%c %Z %z')
'Sat Nov  1 12:00:00 2014 EDT -0400'
>>> t += timedelta(1)
>>> t.strftime('%c %Z %z')
'Sun Nov  2 12:00:00 2014 EST -0500'

This is unmodified Python 3.4.3 running an official documentation example.


More information about the Datetime-SIG mailing list