Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
b004943e
Commit
b004943e
authored
Nov 26, 2014
by
Ethan Furman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(3.4) Issue22780: reword NotImplemented docs to emphasise should
parent
e823933f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
4 deletions
+26
-4
Doc/library/constants.rst
Doc/library/constants.rst
+18
-3
Doc/library/numbers.rst
Doc/library/numbers.rst
+2
-0
Doc/reference/datamodel.rst
Doc/reference/datamodel.rst
+6
-1
No files found.
Doc/library/constants.rst
View file @
b004943e
...
...
@@ -26,9 +26,24 @@ A small number of constants live in the built-in namespace. They are:
.. data:: NotImplemented
Special value which can be returned by the "rich comparison" special methods
(:meth:`__eq__`, :meth:`__lt__`, and friends), to indicate that the comparison
is not implemented with respect to the other type.
Special value which should be returned by the binary special methods
(e.g. :meth:`__eq__`, :meth:`__lt__`, :meth:`__add__`, :meth:`__rsub__`,
etc.) to indicate that the operation is not implemented with respect to
the other type; may be returned by the in-place binary special methods
(e.g. :meth:`__imul__`, :meth:`__iand__`, etc.) for the same purpose.
Its truth value is true.
.. note::
When ``NotImplemented`` is returned, the interpreter will then try the
reflected operation on the other type, or some other fallback, depending
on the operator. If all attempted operations return ``NotImplemented``, the
interpreter will raise an appropriate exception.
See
:ref:`implementing-the-arithmetic-operations`
for more details.
.. data:: Ellipsis
...
...
Doc/library/numbers.rst
View file @
b004943e
...
...
@@ -110,6 +110,8 @@ those. You can add ``MyFoo`` between :class:`Complex` and
MyFoo.register(Real)
.. _implementing-the-arithmetic-operations:
Implementing the arithmetic operations
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
...
...
Doc/reference/datamodel.rst
View file @
b004943e
...
...
@@ -154,11 +154,16 @@ NotImplemented
This type has a single value. There is a single object with this value. This
object is accessed through the built-in name ``NotImplemented``. Numeric methods
and rich comparison methods
may
return this value if they do not implement the
and rich comparison methods
should
return this value if they do not implement the
operation for the operands provided. (The interpreter will then try the
reflected operation, or some other fallback, depending on the operator.) Its
truth value is true.
See
:ref:`implementing-the-arithmetic-operations`
for more details.
Ellipsis
.. index:: object: Ellipsis
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment