Title: datetime's documentation refers to "comparison [...] falling back to the default scheme of comparing object addresses"
Type: Stage: patch review
Components: Documentation Versions: Python 3.8, Python 3.7, Python 3.6
Status: open Resolution:
Dependencies: Superseder:
Assigned To: docs@python Nosy List: Kevin.Norris, docs@python, p-ganssle, prakashdanish
Priority: normal Keywords: easy, patch

Created on 2018-08-09 05:03 by Kevin.Norris, last changed 2018-08-20 19:43 by p-ganssle.

Pull Requests
URL Status Linked Edit
PR 8814 open prakashdanish, 2018-08-19 02:38
Messages (3)
msg323314 - (view) Author: Kevin Norris (Kevin.Norris) Date: 2018-08-09 05:03
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.
msg323695 - (view) Author: Danish Prakash (prakashdanish) * Date: 2018-08-18 08:53
> But in 3.x, comparison no longer falls back to comparing object addresses.

What is the default fallback in 3.x?
msg323710 - (view) Author: Kevin Norris (Kevin.Norris) Date: 2018-08-18 13:15
There is none.  It raises a TypeError.  See
Date User Action Args
2018-08-20 19:43:36p-gansslesetnosy: + p-ganssle
2018-08-19 02:38:36prakashdanishsetkeywords: + patch
stage: patch review
pull_requests: + pull_request8292
2018-08-18 13:15:30Kevin.Norrissetmessages: + msg323710
2018-08-18 08:53:45prakashdanishsetnosy: + prakashdanish
messages: + msg323695
2018-08-17 17:58:49steve.dowersetkeywords: + easy
versions: - Python 3.4, Python 3.5
2018-08-09 05:03:49Kevin.Norriscreate