Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 390d29c

Browse files
committed
Remove isCallable() and sequenceIncludes() from the operator module.
1 parent 7d71fb8 commit 390d29c

4 files changed

Lines changed: 4 additions & 21 deletions

File tree

Lib/test/test_bool.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -257,8 +257,6 @@ def test_operator(self):
257257
import operator
258258
self.assertIs(operator.truth(0), False)
259259
self.assertIs(operator.truth(1), True)
260-
self.assertIs(operator.isCallable(0), False)
261-
self.assertIs(operator.isCallable(len), True)
262260
self.assertIs(operator.isNumberType(None), False)
263261
self.assertIs(operator.isNumberType(0), True)
264262
self.assertIs(operator.not_(1), False)

Lib/test/test_operator.py

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -177,17 +177,6 @@ def test_invert(self):
177177
self.failUnlessRaises(TypeError, operator.invert, None)
178178
self.failUnless(operator.inv(4) == -5)
179179

180-
def test_isCallable(self):
181-
self.failUnlessRaises(TypeError, operator.isCallable)
182-
class C:
183-
pass
184-
def check(self, o, v):
185-
self.assert_(operator.isCallable(o) == callable(o) == v)
186-
check(self, 4, 0)
187-
check(self, operator.isCallable, 1)
188-
check(self, C, 1)
189-
check(self, C(), 0)
190-
191180
def test_isMappingType(self):
192181
self.failUnlessRaises(TypeError, operator.isMappingType)
193182
self.failIf(operator.isMappingType(1))
@@ -296,8 +285,6 @@ def test_contains(self):
296285
self.failUnlessRaises(TypeError, operator.contains, None, None)
297286
self.failUnless(operator.contains(range(4), 2))
298287
self.failIf(operator.contains(range(4), 5))
299-
self.failUnless(operator.sequenceIncludes(range(4), 2))
300-
self.failIf(operator.sequenceIncludes(range(4), 5))
301288

302289
def test_setitem(self):
303290
a = range(3)

Misc/NEWS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,10 @@ Core and Builtins
156156
Extension Modules
157157
-----------------
158158

159+
- isCallable() and sequenceIncludes() have been removed from the operator
160+
module.
161+
162+
159163
Library
160164
-------
161165

Modules/operator.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ used for special class methods; variants without leading and trailing\n\
6565
if(! PyArg_UnpackTuple(a,#OP,2,2,&a1,&a2)) return NULL; \
6666
return PyObject_RichCompare(a1,a2,A); }
6767

68-
spami(isCallable , PyCallable_Check)
6968
spami(isNumberType , PyNumber_Check)
7069
spami(truth , PyObject_IsTrue)
7170
spam2(op_add , PyNumber_Add)
@@ -102,7 +101,6 @@ spamoi(op_repeat , PySequence_Repeat)
102101
spam2(op_iconcat , PySequence_InPlaceConcat)
103102
spamoi(op_irepeat , PySequence_InPlaceRepeat)
104103
spami2b(op_contains , PySequence_Contains)
105-
spami2b(sequenceIncludes, PySequence_Contains)
106104
spamn2(indexOf , PySequence_Index)
107105
spamn2(countOf , PySequence_Count)
108106
spami(isMappingType , PyMapping_Check)
@@ -218,8 +216,6 @@ op_delslice(PyObject *s, PyObject *a)
218216

219217
static struct PyMethodDef operator_methods[] = {
220218

221-
spam1o(isCallable,
222-
"isCallable(a) -- Same as callable(a).")
223219
spam1o(isNumberType,
224220
"isNumberType(a) -- Return True if a has a numeric type, False otherwise.")
225221
spam1o(isSequenceType,
@@ -228,8 +224,6 @@ spam1o(truth,
228224
"truth(a) -- Return True if a is true, False otherwise.")
229225
spam2(contains,__contains__,
230226
"contains(a, b) -- Same as b in a (note reversed operands).")
231-
spam1(sequenceIncludes,
232-
"sequenceIncludes(a, b) -- Same as b in a (note reversed operands; deprecated).")
233227
spam1(indexOf,
234228
"indexOf(a, b) -- Return the first index of b in a.")
235229
spam1(countOf,

0 commit comments

Comments
 (0)