[Python-Dev] Status on PEP-431 Timezones
Mark Lawrence
breamoreboy at yahoo.co.uk
Tue Jul 28 03:22:12 CEST 2015
On 28/07/2015 01:58, Tres Seaver wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On 07/27/2015 06:03 PM, Tim Peters wrote:
>
>> Even if days weren't a distinguished unit for timedelta, I'd still
>> much rather write, e.g.,
>>
>> timedelta(days=5, hours=3)
>>
>> than
>>
>> timedelta(hours=123)
>>
>> or
>>
>> timedelta(hours=5*24 + 3)
>>
>> etc. The intent of the first spelling is obvious at a glance.
>
> - From a human's perspective, "a day from now" is always potentially
> unambigous, just like "a month from now" or "a year from now", whereas
> "24 hours from now" is never so. In a given application, a user who
> doesn't care can always write a helper function to generate hours; in an
> applicatino whose developer who *does* care, the 'days' argument to
> timedelta in its current does *not* help achieve her goal: it is an
> attractive nuisance she will have to learn to avoid.
>
To me a day is precisely 24 hours, no more, no less. I have no interest
in messing about with daylight savings of 30 minutes, one hour, two
hours or any other variant that I've not heard about.
In my mission critical code, which I use to predict my cashflow, I use
code such as.
timedelta(days=14)
Is somebody now going to tell me that this isn't actually two weeks?
--
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.
Mark Lawrence
More information about the Python-Dev
mailing list