[docs] [issue34365] datetime's documentation refers to "comparison [...] falling back to the default scheme of comparing object addresses"
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
nosy: Kevin.Norris, docs at python
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>
More information about the docs