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
78be7357
Commit
78be7357
authored
Aug 16, 2003
by
Raymond Hettinger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Keep doctests in sync with the docs.
parent
a44528e8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
5 deletions
+5
-5
Lib/test/test_sets.py
Lib/test/test_sets.py
+5
-5
No files found.
Lib/test/test_sets.py
View file @
78be7357
...
...
@@ -634,10 +634,10 @@ Example from the Library Reference: Doc/lib/libsets.tex
... return Base._repr(self, sorted=True)
>>> engineers = Set(['John', 'Jane', 'Jack', 'Janice'])
>>> programmers = Set(['Jack', 'Sam', 'Susan', 'Janice'])
>>> manage
ment
= Set(['Jane', 'Jack', 'Susan', 'Zack'])
>>> employees = engineers | programmers | manage
ment
# union
>>> engineering_management = engineers &
programmers
# intersection
>>> fulltime_management = manage
ment
- engineers - programmers # difference
>>> manage
rs
= Set(['Jane', 'Jack', 'Susan', 'Zack'])
>>> employees = engineers | programmers | manage
rs
# union
>>> engineering_management = engineers &
managers
# intersection
>>> fulltime_management = manage
rs
- engineers - programmers # difference
>>> engineers.add('Marvin')
>>> print engineers
Set(['Jack', 'Jane', 'Janice', 'John', 'Marvin'])
...
...
@@ -646,7 +646,7 @@ False
>>> employees.update(engineers) # update from another set
>>> employees.issuperset(engineers)
True
>>> for group in [engineers, programmers, manage
ment
, employees]:
>>> for group in [engineers, programmers, manage
rs
, employees]:
... group.discard('Susan') # unconditionally remove element
... print group
...
...
...
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