summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCollin Winter <collinw@gmail.com>2007-03-21 20:10:51 (GMT)
committerCollin Winter <collinw@gmail.com>2007-03-21 20:10:51 (GMT)
commit390d29ca743d262cf667a794af71f141a7a161f6 (patch)
tree58597de1d1afc12d23b88be69535d958ec73d90e
parent7d71fb8132d1ce0c49ad4557b89da592120cf118 (diff)
downloadcpython-390d29ca743d262cf667a794af71f141a7a161f6.zip
cpython-390d29ca743d262cf667a794af71f141a7a161f6.tar.gz
cpython-390d29ca743d262cf667a794af71f141a7a161f6.tar.bz2
Remove isCallable() and sequenceIncludes() from the operator module.
-rw-r--r--Lib/test/test_bool.py2
-rw-r--r--Lib/test/test_operator.py13
-rw-r--r--Misc/NEWS4
-rw-r--r--Modules/operator.c6
4 files changed, 4 insertions, 21 deletions
diff --git a/Lib/test/test_bool.py b/Lib/test/test_bool.py
index 1d9a60b..1e19cf5 100644
--- a/Lib/test/test_bool.py
+++ b/Lib/test/test_bool.py
@@ -257,8 +257,6 @@ class BoolTest(unittest.TestCase):
import operator
self.assertIs(operator.truth(0), False)
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(0), True)
self.assertIs(operator.not_(1), False)
diff --git a/Lib/test/test_operator.py b/Lib/test/test_operator.py
index e05d054..f9519b2 100644
--- a/Lib/test/test_operator.py
+++ b/Lib/test/test_operator.py
@@ -177,17 +177,6 @@ class OperatorTestCase(unittest.TestCase):
self.failUnlessRaises(TypeError, operator.invert, None)
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):
self.failUnlessRaises(TypeError, operator.isMappingType)
self.failIf(operator.isMappingType(1))
@@ -296,8 +285,6 @@ class OperatorTestCase(unittest.TestCase):
self.failUnlessRaises(TypeError, operator.contains, None, None)
self.failUnless(operator.contains(range(4), 2))
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):
a = range(3)
diff --git a/Misc/NEWS b/Misc/NEWS
index 002a26c..c2699ec 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -156,6 +156,10 @@ Core and Builtins
Extension Modules
-----------------
+- isCallable() and sequenceIncludes() have been removed from the operator
+ module.
+
+
Library
-------
diff --git a/Modules/operator.c b/Modules/operator.c
index fa40da4..90fac7961 100644
--- a/Modules/operator.c
+++ b/Modules/operator.c
@@ -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; \
return PyObject_RichCompare(a1,a2,A); }
-spami(isCallable , PyCallable_Check)
spami(isNumberType , PyNumber_Check)
spami(truth , PyObject_IsTrue)
spam2(op_add , PyNumber_Add)
@@ -102,7 +101,6 @@ spamoi(op_repeat , PySequence_Repeat)
spam2(op_iconcat , PySequence_InPlaceConcat)
spamoi(op_irepeat , PySequence_InPlaceRepeat)
spami2b(op_contains , PySequence_Contains)
-spami2b(sequenceIncludes, PySequence_Contains)
spamn2(indexOf , PySequence_Index)
spamn2(countOf , PySequence_Count)
spami(isMappingType , PyMapping_Check)
@@ -218,8 +216,6 @@ op_delslice(PyObject *s, PyObject *a)
static struct PyMethodDef operator_methods[] = {
-spam1o(isCallable,
- "isCallable(a) -- Same as callable(a).")
spam1o(isNumberType,
"isNumberType(a) -- Return True if a has a numeric type, False otherwise.")
spam1o(isSequenceType,
@@ -228,8 +224,6 @@ spam1o(truth,
"truth(a) -- Return True if a is true, False otherwise.")
spam2(contains,__contains__,
"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,
"indexOf(a, b) -- Return the first index of b in a.")
spam1(countOf,