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
11cda476
Commit
11cda476
authored
Jul 03, 2014
by
Raymond Hettinger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix guidance for subclassing collections.Set()
parent
2dba23af
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
2 deletions
+2
-2
Doc/library/collections.abc.rst
Doc/library/collections.abc.rst
+1
-1
Lib/_collections_abc.py
Lib/_collections_abc.py
+1
-1
No files found.
Doc/library/collections.abc.rst
View file @
11cda476
...
@@ -173,7 +173,7 @@ Notes on using :class:`Set` and :class:`MutableSet` as a mixin:
...
@@ -173,7 +173,7 @@ Notes on using :class:`Set` and :class:`MutableSet` as a mixin:
(2)
(2)
To override the comparisons (presumably for speed, as the
To override the comparisons (presumably for speed, as the
semantics are fixed), redefine :meth:`__le__` and
semantics are fixed), redefine :meth:`__le__` and
:meth:`__ge__`,
then the other operations will automatically follow suit.
then the other operations will automatically follow suit.
(3)
(3)
...
...
Lib/_collections_abc.py
View file @
11cda476
...
@@ -183,7 +183,7 @@ class Set(Sized, Iterable, Container):
...
@@ -183,7 +183,7 @@ class Set(Sized, Iterable, Container):
methods except for __contains__, __iter__ and __len__.
methods except for __contains__, __iter__ and __len__.
To override the comparisons (presumably for speed, as the
To override the comparisons (presumably for speed, as the
semantics are fixed),
all you have to do is redefine __le__ and
semantics are fixed),
redefine __le__ and __ge__,
then the other operations will automatically follow suit.
then the other operations will automatically follow suit.
"""
"""
...
...
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