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
0da9d90b
Commit
0da9d90b
authored
Aug 21, 2002
by
Guido van Rossum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add Raymond H to the list of authors; add some XXX comments about
possible API improvements.
parent
60b00913
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
0 deletions
+9
-0
Lib/sets.py
Lib/sets.py
+9
-0
No files found.
Lib/sets.py
View file @
0da9d90b
...
...
@@ -51,6 +51,9 @@ what's tested is actually `z in y'.
#
# - Guido van Rossum rewrote much of the code, made some API changes,
# and cleaned up the docstrings.
#
# - Raymond Hettinger implemented a number of speedups and other
# improvements.
__all__
=
[
'BaseSet'
,
'Set'
,
'ImmutableSet'
]
...
...
@@ -67,6 +70,7 @@ class BaseSet(object):
"""This is an abstract class."""
# Don't call this from a concrete subclass!
if
self
.
__class__
is
BaseSet
:
# XXX Maybe raise TypeError instead, like basestring()?
raise
NotImplementedError
,
(
"BaseSet is an abstract class. "
"Use Set or ImmutableSet."
)
...
...
@@ -285,6 +289,8 @@ class ImmutableSet(BaseSet):
def
__init__
(
self
,
seq
):
"""Construct an immutable set from a sequence."""
# XXX Maybe this should default seq to None?
# XXX Creating an empty immutable set is not unheard of.
self
.
_hashcode
=
None
self
.
_data
=
data
=
{}
# I don't know a faster way to do this in pure Python.
...
...
@@ -296,6 +302,9 @@ class ImmutableSet(BaseSet):
value
=
True
# XXX Should this perhaps look for _as_immutable?
# XXX If so, should use self.update(seq).
# XXX (Well, ImmutableSet doesn't have update(); the base
# XXX class could have _update() which does this though, and
# XXX we could use that here and in Set.update().)
for
key
in
seq
:
data
[
key
]
=
value
...
...
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