[Python-checkins] bpo-34365: Update date object documentation (GH-8814)
Miss Islington (bot)
webhook-mailer at python.org
Tue Sep 11 17:27:09 EDT 2018
https://github.com/python/cpython/commit/8a2c2d4e1b6b46a9a982e5c064ca4399ec28d55d
commit: 8a2c2d4e1b6b46a9a982e5c064ca4399ec28d55d
branch: 3.6
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: GitHub <noreply at github.com>
date: 2018年09月11日T14:27:06-07:00
summary:
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 -->
(cherry picked from commit 9c223794c754408644c16349b85dd27fdba8a926)
Co-authored-by: Danish Prakash <grafitykoncept at gmail.com>
files:
M Doc/library/datetime.rst
diff --git a/Doc/library/datetime.rst b/Doc/library/datetime.rst
index 89f85fc11ad4..88bc328e3a1d 100644
--- a/Doc/library/datetime.rst
+++ b/Doc/library/datetime.rst
@@ -510,10 +510,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
More information about the Python-checkins
mailing list