Skip to content

Commit c3bcc92

Browse files
gh-160035: Simplify datetime awareness docs (#160086)
Co-authored-by: Stan Ulbrych <stan@python.org>
1 parent 9f3d506 commit c3bcc92

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
@@ -180,18 +180,12 @@ Objects of the :class:`date` type are always naive.
180180

181181
An object of type :class:`.time` or :class:`.datetime` may be aware or naive.
182182

183-
A :class:`.datetime` object ``d`` is aware if both of the following hold:
184-
185-
1. ``d.tzinfo`` is not ``None``
186-
2. ``d.tzinfo.utcoffset(d)`` does not return ``None``
187-
183+
A :class:`.datetime` object ``d`` is aware if
184+
:meth:`d.utcoffset() <datetime.utcoffset>` does not return ``None``.
188185
Otherwise, ``d`` is naive.
189186

190-
A :class:`.time` object ``t`` is aware if both of the following hold:
191-
192-
1. ``t.tzinfo`` is not ``None``
193-
2. ``t.tzinfo.utcoffset(None)`` does not return ``None``.
194-
187+
A :class:`.time` object ``t`` is aware if
188+
:meth:`t.utcoffset() <time.utcoffset>` does not return ``None``.
195189
Otherwise, ``t`` is naive.
196190

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

0 commit comments

Comments
 (0)