Skip to content

Commit 260ee94

Browse files
miss-islingtonMilan-CSEStanFromIreland
authored
[3.14] gh-160035: Simplify datetime awareness docs (GH-160086) (#160212)
(cherry picked from commit c3bcc92) Co-authored-by: Nakum Milan <milannakum.ce22@sltiet.edu.in> Co-authored-by: Stan Ulbrych <stan@python.org>
1 parent f3059d6 commit 260ee94

1 file changed

Lines changed: 4 additions & 10 deletions

File tree

‎Doc/library/datetime.rst‎

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -184,18 +184,12 @@ Objects of the :class:`date` type are always naive.
184184

185185
An object of type :class:`.time` or :class:`.datetime` may be aware or naive.
186186

187-
A :class:`.datetime` object ``d`` is aware if both of the following hold:
188-
189-
1. ``d.tzinfo`` is not ``None``
190-
2. ``d.tzinfo.utcoffset(d)`` does not return ``None``
191-
187+
A :class:`.datetime` object ``d`` is aware if
188+
:meth:`d.utcoffset() <datetime.utcoffset>` does not return ``None``.
192189
Otherwise, ``d`` is naive.
193190

194-
A :class:`.time` object ``t`` is aware if both of the following hold:
195-
196-
1. ``t.tzinfo`` is not ``None``
197-
2. ``t.tzinfo.utcoffset(None)`` does not return ``None``.
198-
191+
A :class:`.time` object ``t`` is aware if
192+
:meth:`t.utcoffset() <time.utcoffset>` does not return ``None``.
199193
Otherwise, ``t`` is naive.
200194

201195
The distinction between aware and naive doesn't apply to :class:`timedelta`

0 commit comments

Comments
 (0)