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
9ff3b741
Commit
9ff3b741
authored
Aug 15, 2003
by
Raymond Hettinger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make sets.py compatible with Py2.2
parent
4caad1ec
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
1 deletion
+21
-1
Lib/sets.py
Lib/sets.py
+19
-1
Misc/NEWS
Misc/NEWS
+2
-0
No files found.
Lib/sets.py
View file @
9ff3b741
...
...
@@ -54,9 +54,27 @@ what's tested is actually `z in y'.
# - Raymond Hettinger added a number of speedups and other
# improvements.
from
__future__
import
generators
try
:
from
itertools
import
ifilter
,
ifilterfalse
except
ImportError
:
# Code to make the module run under Py2.2
def
ifilter
(
predicate
,
iterable
):
if
predicate
is
None
:
def
predicate
(
x
):
return
x
for
x
in
iterable
:
if
predicate
(
x
):
yield
x
def
ifilterfalse
(
predicate
,
iterable
):
if
predicate
is
None
:
def
predicate
(
x
):
return
x
for
x
in
iterable
:
if
not
predicate
(
x
):
yield
x
__all__
=
[
'BaseSet'
,
'Set'
,
'ImmutableSet'
]
from
itertools
import
ifilter
,
ifilterfalse
class
BaseSet
(
object
):
"""Common base class for mutable and immutable sets."""
...
...
Misc/NEWS
View file @
9ff3b741
...
...
@@ -30,6 +30,8 @@ Extension modules
Library
-------
-
sets
.
py
now
runs
under
Py2
.2
-
random
.
seed
()
with
no
arguments
or
None
uses
time
.
time
()
as
a
default
seed
.
Modified
to
match
Py2
.2
behavior
and
use
fractional
seconds
so
that
successive
runs
are
more
likely
to
produce
different
sequences
.
...
...
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