[Python-ideas] Date/time literals

Guido van Rossum guido at python.org
Tue Jun 1 18:36:42 CEST 2010


On Tue, Jun 1, 2010 at 9:28 AM, Mark Dickinson <dickinsm at gmail.com> wrote:
> On Tue, Jun 1, 2010 at 5:07 PM, Guido van Rossum <guido at python.org> wrote:
>> What's the use case for these relaxations in argument range checking?
>> I'd say they are more confusing, since they might lead one to suspect
>> that leap seconds are in fact supported.
>
> For the first, it would prevent tuples corresponding to valid UTC
> times (or local times) causing an exception in the datetime
> constructor.  I don't have any specific use-cases, but it's not hard
> to imagine passing a tuple from some external UTC-supporting source to
> datetime.datetime.

Imagined use cases are just that.

> The second relaxation (allowing 24:00:00) comes from ISO 8601, but I
> don't really know how widespread its use is.  I admit I don't find
> this one particularly convincing;  perhaps Masklinn can expand on why
> it's useful.

This I can understand, but more for output than for input. It is
useful to specify the end time of an event (e.g. a party) ending at
midnight as ending at 24:00 on a given date rather than at 00:00 on
the next day, since that might confuse humans.

-- 
--Guido van Rossum (python.org/~guido)



More information about the Python-ideas mailing list