diff options
author | Danish Prakash <grafitykoncept@gmail.com> | 2018-09-11 20:59:23 (GMT) |
---|---|---|
committer | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2018-09-11 20:59:23 (GMT) |
commit | 9c223794c754408644c16349b85dd27fdba8a926 (patch) | |
tree | 898460e0409311c35a4000fe0aaa5250aadba782 /Doc/library/datetime.rst | |
parent | 24bd50bdcc97d65130c07d6cd26085fd06c3e972 (diff) | |
download | cpython-9c223794c754408644c16349b85dd27fdba8a926.zip cpython-9c223794c754408644c16349b85dd27fdba8a926.tar.gz cpython-9c223794c754408644c16349b85dd27fdba8a926.tar.bz2 |
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 -->
Diffstat (limited to 'Doc/library/datetime.rst')
-rw-r--r-- | Doc/library/datetime.rst | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/Doc/library/datetime.rst b/Doc/library/datetime.rst index 53c181c..2258247 100644 --- a/Doc/library/datetime.rst +++ b/Doc/library/datetime.rst @@ -526,10 +526,9 @@ Notes: (4) 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 - :exc:`TypeError` if the other comparand isn't also a :class:`date` object. - However, ``NotImplemented`` is returned instead if the other comparand has a + date2.toordinal()``. Date comparison raises :exc:`TypeError` if + the other comparand isn't also a :class:`date` object. However, + ``NotImplemented`` is returned instead if the other comparand has a :meth:`timetuple` attribute. This hook gives other kinds of date objects a chance at implementing mixed-type comparison. If not, when a :class:`date` object is compared to an object of a different type, :exc:`TypeError` is raised |