[pypy-svn] rev 2664 - in pypy/trunk/src/pypy: module objspace/std

alex at codespeak.net alex at codespeak.net
Mon Dec 22 00:46:56 CET 2003


Author: alex
Date: Mon Dec 22 00:46:56 2003
New Revision: 2664

Modified:
   pypy/trunk/src/pypy/module/builtin.py
   pypy/trunk/src/pypy/objspace/std/slicetype.py
Log:
removed the new builtin 'sign' and its uses in slicetype (easily replaced
with cmp(..., 0), as Patrick Maupin suggested last night over a beer).


Modified: pypy/trunk/src/pypy/module/builtin.py
==============================================================================
--- pypy/trunk/src/pypy/module/builtin.py	(original)
+++ pypy/trunk/src/pypy/module/builtin.py	Mon Dec 22 00:46:56 2003
@@ -320,17 +320,6 @@
             total = total + item
         return total
 
-    # This function was not in the original builtins,
-    # but is quite useful for some aspects of PyPy
-    # implementation.
-    def app_sign(self, a):
-        if a > 0:
-            return 1
-        elif a < 0:
-            return -1
-        else:
-            return 0
-
     #XXX works only for new-style classes.
     #So we have to fix it, when we add support for old-style classes
     def issubclass(self, w_cls1, w_cls2):

Modified: pypy/trunk/src/pypy/objspace/std/slicetype.py
==============================================================================
--- pypy/trunk/src/pypy/objspace/std/slicetype.py	(original)
+++ pypy/trunk/src/pypy/objspace/std/slicetype.py	Mon Dec 22 00:46:56 2003
@@ -86,8 +86,8 @@
 def app_slice_indices4(slice, sequencelength):
     start, stop, step = slice_indices3(slice, sequencelength)
     slicelength = stop - start
-    lengthsign = sign(slicelength)
-    stepsign = sign(step)
+    lengthsign = cmp(slicelength, 0)
+    stepsign = cmp(step, 0)
     if stepsign == lengthsign:
         slicelength = (slicelength - lengthsign) // step + 1
     else:


More information about the Pypy-commit mailing list