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
390d29ca
Commit
390d29ca
authored
Mar 21, 2007
by
Collin Winter
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove isCallable() and sequenceIncludes() from the operator module.
parent
7d71fb81
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
4 additions
and
21 deletions
+4
-21
Lib/test/test_bool.py
Lib/test/test_bool.py
+0
-2
Lib/test/test_operator.py
Lib/test/test_operator.py
+0
-13
Misc/NEWS
Misc/NEWS
+4
-0
Modules/operator.c
Modules/operator.c
+0
-6
No files found.
Lib/test/test_bool.py
View file @
390d29ca
...
@@ -257,8 +257,6 @@ class BoolTest(unittest.TestCase):
...
@@ -257,8 +257,6 @@ class BoolTest(unittest.TestCase):
import
operator
import
operator
self
.
assertIs
(
operator
.
truth
(
0
),
False
)
self
.
assertIs
(
operator
.
truth
(
0
),
False
)
self
.
assertIs
(
operator
.
truth
(
1
),
True
)
self
.
assertIs
(
operator
.
truth
(
1
),
True
)
self
.
assertIs
(
operator
.
isCallable
(
0
),
False
)
self
.
assertIs
(
operator
.
isCallable
(
len
),
True
)
self
.
assertIs
(
operator
.
isNumberType
(
None
),
False
)
self
.
assertIs
(
operator
.
isNumberType
(
None
),
False
)
self
.
assertIs
(
operator
.
isNumberType
(
0
),
True
)
self
.
assertIs
(
operator
.
isNumberType
(
0
),
True
)
self
.
assertIs
(
operator
.
not_
(
1
),
False
)
self
.
assertIs
(
operator
.
not_
(
1
),
False
)
...
...
Lib/test/test_operator.py
View file @
390d29ca
...
@@ -177,17 +177,6 @@ class OperatorTestCase(unittest.TestCase):
...
@@ -177,17 +177,6 @@ class OperatorTestCase(unittest.TestCase):
self
.
failUnlessRaises
(
TypeError
,
operator
.
invert
,
None
)
self
.
failUnlessRaises
(
TypeError
,
operator
.
invert
,
None
)
self
.
failUnless
(
operator
.
inv
(
4
)
==
-
5
)
self
.
failUnless
(
operator
.
inv
(
4
)
==
-
5
)
def
test_isCallable
(
self
):
self
.
failUnlessRaises
(
TypeError
,
operator
.
isCallable
)
class
C
:
pass
def
check
(
self
,
o
,
v
):
self
.
assert_
(
operator
.
isCallable
(
o
)
==
callable
(
o
)
==
v
)
check
(
self
,
4
,
0
)
check
(
self
,
operator
.
isCallable
,
1
)
check
(
self
,
C
,
1
)
check
(
self
,
C
(),
0
)
def
test_isMappingType
(
self
):
def
test_isMappingType
(
self
):
self
.
failUnlessRaises
(
TypeError
,
operator
.
isMappingType
)
self
.
failUnlessRaises
(
TypeError
,
operator
.
isMappingType
)
self
.
failIf
(
operator
.
isMappingType
(
1
))
self
.
failIf
(
operator
.
isMappingType
(
1
))
...
@@ -296,8 +285,6 @@ class OperatorTestCase(unittest.TestCase):
...
@@ -296,8 +285,6 @@ class OperatorTestCase(unittest.TestCase):
self
.
failUnlessRaises
(
TypeError
,
operator
.
contains
,
None
,
None
)
self
.
failUnlessRaises
(
TypeError
,
operator
.
contains
,
None
,
None
)
self
.
failUnless
(
operator
.
contains
(
range
(
4
),
2
))
self
.
failUnless
(
operator
.
contains
(
range
(
4
),
2
))
self
.
failIf
(
operator
.
contains
(
range
(
4
),
5
))
self
.
failIf
(
operator
.
contains
(
range
(
4
),
5
))
self
.
failUnless
(
operator
.
sequenceIncludes
(
range
(
4
),
2
))
self
.
failIf
(
operator
.
sequenceIncludes
(
range
(
4
),
5
))
def
test_setitem
(
self
):
def
test_setitem
(
self
):
a
=
range
(
3
)
a
=
range
(
3
)
...
...
Misc/NEWS
View file @
390d29ca
...
@@ -156,6 +156,10 @@ Core and Builtins
...
@@ -156,6 +156,10 @@ Core and Builtins
Extension Modules
Extension Modules
-----------------
-----------------
- isCallable() and sequenceIncludes() have been removed from the operator
module.
Library
Library
-------
-------
...
...
Modules/operator.c
View file @
390d29ca
...
@@ -65,7 +65,6 @@ used for special class methods; variants without leading and trailing\n\
...
@@ -65,7 +65,6 @@ used for special class methods; variants without leading and trailing\n\
if(! PyArg_UnpackTuple(a,#OP,2,2,&a1,&a2)) return NULL; \
if(! PyArg_UnpackTuple(a,#OP,2,2,&a1,&a2)) return NULL; \
return PyObject_RichCompare(a1,a2,A); }
return PyObject_RichCompare(a1,a2,A); }
spami
(
isCallable
,
PyCallable_Check
)
spami
(
isNumberType
,
PyNumber_Check
)
spami
(
isNumberType
,
PyNumber_Check
)
spami
(
truth
,
PyObject_IsTrue
)
spami
(
truth
,
PyObject_IsTrue
)
spam2
(
op_add
,
PyNumber_Add
)
spam2
(
op_add
,
PyNumber_Add
)
...
@@ -102,7 +101,6 @@ spamoi(op_repeat , PySequence_Repeat)
...
@@ -102,7 +101,6 @@ spamoi(op_repeat , PySequence_Repeat)
spam2
(
op_iconcat
,
PySequence_InPlaceConcat
)
spam2
(
op_iconcat
,
PySequence_InPlaceConcat
)
spamoi
(
op_irepeat
,
PySequence_InPlaceRepeat
)
spamoi
(
op_irepeat
,
PySequence_InPlaceRepeat
)
spami2b
(
op_contains
,
PySequence_Contains
)
spami2b
(
op_contains
,
PySequence_Contains
)
spami2b
(
sequenceIncludes
,
PySequence_Contains
)
spamn2
(
indexOf
,
PySequence_Index
)
spamn2
(
indexOf
,
PySequence_Index
)
spamn2
(
countOf
,
PySequence_Count
)
spamn2
(
countOf
,
PySequence_Count
)
spami
(
isMappingType
,
PyMapping_Check
)
spami
(
isMappingType
,
PyMapping_Check
)
...
@@ -218,8 +216,6 @@ op_delslice(PyObject *s, PyObject *a)
...
@@ -218,8 +216,6 @@ op_delslice(PyObject *s, PyObject *a)
static
struct
PyMethodDef
operator_methods
[]
=
{
static
struct
PyMethodDef
operator_methods
[]
=
{
spam1o
(
isCallable
,
"isCallable(a) -- Same as callable(a)."
)
spam1o
(
isNumberType
,
spam1o
(
isNumberType
,
"isNumberType(a) -- Return True if a has a numeric type, False otherwise."
)
"isNumberType(a) -- Return True if a has a numeric type, False otherwise."
)
spam1o
(
isSequenceType
,
spam1o
(
isSequenceType
,
...
@@ -228,8 +224,6 @@ spam1o(truth,
...
@@ -228,8 +224,6 @@ spam1o(truth,
"truth(a) -- Return True if a is true, False otherwise."
)
"truth(a) -- Return True if a is true, False otherwise."
)
spam2
(
contains
,
__contains__
,
spam2
(
contains
,
__contains__
,
"contains(a, b) -- Same as b in a (note reversed operands)."
)
"contains(a, b) -- Same as b in a (note reversed operands)."
)
spam1
(
sequenceIncludes
,
"sequenceIncludes(a, b) -- Same as b in a (note reversed operands; deprecated)."
)
spam1
(
indexOf
,
spam1
(
indexOf
,
"indexOf(a, b) -- Return the first index of b in a."
)
"indexOf(a, b) -- Return the first index of b in a."
)
spam1
(
countOf
,
spam1
(
countOf
,
...
...
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