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
e4b7ea24
Commit
e4b7ea24
authored
Aug 20, 2002
by
Guido van Rossum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename popitem() to pop(). (An idea from SF patch 597444.)
parent
86a5b830
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
3 deletions
+3
-3
Lib/sets.py
Lib/sets.py
+1
-1
Lib/test/test_sets.py
Lib/test/test_sets.py
+2
-2
No files found.
Lib/sets.py
View file @
e4b7ea24
...
...
@@ -420,7 +420,7 @@ class Set(BaseSet):
except
KeyError
:
pass
def
pop
item
(
self
):
def
pop
(
self
):
"""Remove and return a randomly-chosen set element."""
return
self
.
_data
.
popitem
()[
0
]
...
...
Lib/test/test_sets.py
View file @
e4b7ea24
...
...
@@ -292,10 +292,10 @@ class TestMutate(unittest.TestCase):
self
.
set
.
clear
()
assert
len
(
self
.
set
)
==
0
,
"Clearing set"
def
test_pop
item
(
self
):
def
test_pop
(
self
):
popped
=
{}
while
self
.
set
:
popped
[
self
.
set
.
pop
item
()]
=
None
popped
[
self
.
set
.
pop
()]
=
None
assert
len
(
popped
)
==
len
(
self
.
values
),
"Popping items"
for
v
in
self
.
values
:
assert
v
in
popped
,
"Popping items"
...
...
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