[docs] [issue8822] datetime naive and aware types should have a well-defined definition that can be cross-referenced
Alexander Belopolsky
report at bugs.python.org
Thu May 27 20:09:09 CEST 2010
Alexander Belopolsky <belopolsky at users.sourceforge.net> added the comment:
> 'naive' and 'aware' are key datetime types - they need a proper
> definition and anchor for crossrefences.
The definition is given in the introductory section:
"""
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.
"""
I am not sure what you propose to add to this. Do you wan't to dedicate a separate subsection to naive and aware time and datetime? I feel that would be an overkill. Would simply adding index entries for naive and aware time/datetime objects be enough?
> It is not said how to make non-naive object,
This may be due to the fact that there is no concrete tzinfo implementation in stdlib. See issue 5094.
I think it can be added in datetime constructor section that providing a tzinfo argument results in an aware object. this is already so for datetime.fromtimestamp.
> how to detect if object of naive or aware.
This is already clear IMO:
"""
An object d of type time or datetime may be naive or aware. d is aware if d.tzinfo is not None and d.tzinfo.utcoffset(d) does not return None. If d.tzinfo is None, or if d.tzinfo is not None but d.tzinfo.utcoffset(d) returns None, d is naive.
"""
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue8822>
_______________________________________
More information about the docs
mailing list