Improving datetime

Steven D'Aprano steve at REMOVE-THIS-cybersource.com.au
Wed Mar 19 18:32:10 EDT 2008


On Wed, 19 Mar 2008 17:40:39 -0400, Nicholas F. Fabry wrote:

> To summarize my proposal VERY briefly:
> 
> 
> - Make aware datetime objects display in local time, but calculate/
> compare in UTC.

Your proposal is ambiguous. What does that mean? Can you give an example?




> - Raise exceptions when an illegal or ambiguous datetime is instantated.

You mean like they already do?

>>> datetime.datetime(2008, 03, 35)  # 35th of March
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: day is out of range for month




As for ambiguous, how can datetime arguments be ambiguous?

    Help on class datetime in module datetime:

    class datetime(date)
     |  datetime(year, month, day[, hour[, minute[, second[, 
                 microsecond[,tzinfo]]]]])


What possible ambiguity is there?


-- 
Steven



More information about the Python-list mailing list