[issue14766] Non-naive time comparison throws naive time error

Chris Bergstresser report at bugs.python.org
Thu May 10 17:14:47 CEST 2012


Chris Bergstresser <chris at subtlety.com> added the comment:

That patch fixes the documentation there, but the description at the top of the distinction between naive and aware time objects at the top datetime module is still wrong.  Here it is:

-----------------

There are two kinds of date and time objects: “naive” and “aware”. This distinction refers to whether the object has any notion of time zone, daylight saving time, or other kind of algorithmic or political time adjustment. Whether a naive datetime object represents Coordinated Universal Time (UTC), local time, or time in some other timezone is purely up to the program, just like it’s up to the program whether a particular number represents metres, miles, or mass. Naive datetime objects are easy to understand and to work with, at the cost of ignoring some aspects of reality.

------------------

The distinction is not whether the object has any notion of "time zone, daylight saving time, or other kind of algorithmic or political time adjustment", but instead whether, in the context it's being used, it can calculate an offset to UTC.  A naive time can be used to create an aware datetime.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue14766>
_______________________________________


More information about the Python-bugs-list mailing list