[docs] [issue34365] datetime's documentation refers to "comparison [...] falling back to the default scheme of comparing object addresses"

Kevin Norris report at bugs.python.org
Thu Aug 9 01:03:49 EDT 2018


New submission from Kevin Norris <nykevin.norris at gmail.com>:

The 3.x datetime documentation contains the following footnote:

> In other words, date1 < date2 if and only if date1.toordinal() < date2.toordinal(). In order to stop comparison from falling back to the default scheme of comparing object addresses, date comparison normally raises TypeError if the other comparand isn’t also a date object. However, NotImplemented is returned instead if the other comparand has a timetuple() attribute. This hook gives other kinds of date objects a chance at implementing mixed-type comparison. If not, when a date object is compared to an object of a different type, TypeError is raised unless the comparison is == or !=. The latter cases return False or True, respectively.

But in 3.x, comparison no longer falls back to comparing object addresses.  Also, some of the comments on issue 8005 seem to suggest that this footnote is not actually true in 3.x (aside from the first sentence, of course).  But regardless, the footnote should not refer to a long dead interpreter behavior as if it were still around.

----------
assignee: docs at python
components: Documentation
messages: 323314
nosy: Kevin.Norris, docs at python
priority: normal
severity: normal
status: open
title: datetime's documentation refers to "comparison [...] falling back to the default scheme of comparing object addresses"
versions: Python 3.4, Python 3.5, Python 3.6, Python 3.7, Python 3.8

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue34365>
_______________________________________


More information about the docs mailing list