Index: Doc/lib/liboperator.tex =================================================================== --- Doc/lib/liboperator.tex (revision 50623) +++ Doc/lib/liboperator.tex (working copy) @@ -58,12 +58,6 @@ \method{__nonzero__()} and \method{__len__()} methods.) \end{funcdesc} -\begin{funcdesc}{truth}{o} -Return \constant{True} if \var{o} is true, and \constant{False} -otherwise. This is equivalent to using the \class{bool} -constructor. -\end{funcdesc} - \begin{funcdesc}{is_}{a, b} Return \code{\var{a} is \var{b}}. Tests object identity. \versionadded{2.3} @@ -77,11 +71,6 @@ The mathematical and bitwise operations are the most numerous: -\begin{funcdesc}{abs}{o} -\funcline{__abs__}{o} -Return the absolute value of \var{o}. -\end{funcdesc} - \begin{funcdesc}{add}{a, b} \funcline{__add__}{a, b} Return \var{a} \code{+} \var{b}, for \var{a} and \var{b} numbers. Index: Lib/xmlrpclib.py =================================================================== --- Lib/xmlrpclib.py (revision 50623) +++ Lib/xmlrpclib.py (working copy) @@ -136,7 +136,7 @@ name (None if not present). """ -import re, string, time, operator +import re, string, time from types import * @@ -294,7 +294,7 @@ """ def __init__(self, value = 0): - self.value = operator.truth(value) + self.value = bool(value) def encode(self, out): out.write("%d\n" % self.value) @@ -331,7 +331,7 @@ def boolean(value, _truefalse=(False, True)): """Convert any Python value to XML-RPC 'boolean'.""" - return _truefalse[operator.truth(value)] + return _truefalse[bool(value)] ## # Wrapper for XML-RPC DateTime values. This converts a time value to Index: Lib/test/test_operator.py =================================================================== --- Lib/test/test_operator.py (revision 50623) +++ Lib/test/test_operator.py (working copy) @@ -99,12 +99,6 @@ self.failIf(operator.gt(1, 2)) self.failIf(operator.gt(1, 2.0)) - def test_abs(self): - self.failUnlessRaises(TypeError, operator.abs) - self.failUnlessRaises(TypeError, operator.abs, None) - self.failUnless(operator.abs(-1) == 1) - self.failUnless(operator.abs(1) == 1) - def test_add(self): self.failUnlessRaises(TypeError, operator.add) self.failUnlessRaises(TypeError, operator.add, None, None) @@ -317,17 +311,6 @@ self.failUnlessRaises(TypeError, operator.sub, None, None) self.failUnless(operator.sub(5, 2) == 3) - def test_truth(self): - class C(object): - def __nonzero__(self): - raise SyntaxError - self.failUnlessRaises(TypeError, operator.truth) - self.failUnlessRaises(SyntaxError, operator.truth, C()) - self.failUnless(operator.truth(5)) - self.failUnless(operator.truth([0])) - self.failIf(operator.truth(0)) - self.failIf(operator.truth([])) - def test_bitwise_xor(self): self.failUnlessRaises(TypeError, operator.xor) self.failUnlessRaises(TypeError, operator.xor, None, None) Index: Lib/test/test_bool.py =================================================================== --- Lib/test/test_bool.py (revision 50623) +++ Lib/test/test_bool.py (working copy) @@ -255,8 +255,6 @@ def test_operator(self): 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) Index: Modules/operator.c =================================================================== --- Modules/operator.c (revision 50623) +++ Modules/operator.c (working copy) @@ -67,7 +67,6 @@ spami(isCallable , PyCallable_Check) spami(isNumberType , PyNumber_Check) -spami(truth , PyObject_IsTrue) spam2(op_add , PyNumber_Add) spam2(op_sub , PyNumber_Subtract) spam2(op_mul , PyNumber_Multiply) @@ -76,7 +75,6 @@ spam2(op_mod , PyNumber_Remainder) spam1(op_neg , PyNumber_Negative) spam1(op_pos , PyNumber_Positive) -spam1(op_abs , PyNumber_Absolute) spam1(op_inv , PyNumber_Invert) spam1(op_invert , PyNumber_Invert) spam2(op_lshift , PyNumber_Lshift) @@ -232,8 +230,6 @@ "isNumberType(a) -- Return True if a has a numeric type, False otherwise.") spam1o(isSequenceType, "isSequenceType(a) -- Return True if a has a sequence type, False otherwise.") -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, @@ -256,7 +252,6 @@ spam2(mod,__mod__, "mod(a, b) -- Same as a % b.") spam2o(neg,__neg__, "neg(a) -- Same as -a.") spam2o(pos,__pos__, "pos(a) -- Same as +a.") -spam2o(abs,__abs__, "abs(a) -- Same as abs(a).") spam2o(inv,__inv__, "inv(a) -- Same as ~a.") spam2o(invert,__invert__, "invert(a) -- Same as ~a.") spam2(lshift,__lshift__, "lshift(a, b) -- Same as a << b.")