Skip to content

Commit 9c22379

Browse files
danishprakashmiss-islington
authored andcommitted
bpo-34365: Update date object documentation (GH-8814)
Python 3.x does not fall back to comparing object addresses when comparing two `dt` objects. <!-- issue-number: [bpo-34365](https://www.bugs.python.org/issue34365) --> https://bugs.python.org/issue34365 <!-- /issue-number -->
1 parent 24bd50b commit 9c22379

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

Doc/library/datetime.rst

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -526,10 +526,9 @@ Notes:
526526

527527
(4)
528528
In other words, ``date1 < date2`` if and only if ``date1.toordinal() <
529-
date2.toordinal()``. In order to stop comparison from falling back to the
530-
default scheme of comparing object addresses, date comparison normally raises
531-
:exc:`TypeError` if the other comparand isn't also a :class:`date` object.
532-
However, ``NotImplemented`` is returned instead if the other comparand has a
529+
date2.toordinal()``. Date comparison raises :exc:`TypeError` if
530+
the other comparand isn't also a :class:`date` object. However,
531+
``NotImplemented`` is returned instead if the other comparand has a
533532
:meth:`timetuple` attribute. This hook gives other kinds of date objects a
534533
chance at implementing mixed-type comparison. If not, when a :class:`date`
535534
object is compared to an object of a different type, :exc:`TypeError` is raised

0 commit comments

Comments
 (0)