https://github.com/python/cpython/commit/260ee94ffdf3800532e1a0da4063565ba26726ab commit: 260ee94ffdf3800532e1a0da4063565ba26726ab branch: 3.14 author: Miss Islington (bot) <[email protected]> committer: StanFromIreland <[email protected]> date: 2026-10-22T07:00:36Z summary:
[3.14] gh-160035: Simplify datetime awareness docs (GH-160086) (#160212) (cherry picked from commit c3bcc927061e5ed058580b8092bbb6564897fcaa) Co-authored-by: Nakum Milan <[email protected]> Co-authored-by: Stan Ulbrych <[email protected]> files: M Doc/library/datetime.rst diff --git a/Doc/library/datetime.rst b/Doc/library/datetime.rst index e6c04fff1c5555..23608cf76c8031 100644 --- a/Doc/library/datetime.rst +++ b/Doc/library/datetime.rst @@ -184,18 +184,12 @@ Objects of the :class:`date` type are always naive. An object of type :class:`.time` or :class:`.datetime` may be aware or naive. -A :class:`.datetime` object ``d`` is aware if both of the following hold: - -1. ``d.tzinfo`` is not ``None`` -2. ``d.tzinfo.utcoffset(d)`` does not return ``None`` - +A :class:`.datetime` object ``d`` is aware if +:meth:`d.utcoffset() <datetime.utcoffset>` does not return ``None``. Otherwise, ``d`` is naive. -A :class:`.time` object ``t`` is aware if both of the following hold: - -1. ``t.tzinfo`` is not ``None`` -2. ``t.tzinfo.utcoffset(None)`` does not return ``None``. - +A :class:`.time` object ``t`` is aware if +:meth:`t.utcoffset() <time.utcoffset>` does not return ``None``. Otherwise, ``t`` is naive. The distinction between aware and naive doesn't apply to :class:`timedelta` _______________________________________________ Python-checkins mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3//lists/python-checkins.python.org Member address: [email protected]
