[pypy-svn] rev 730 - pypy/trunk/src/pypy/objspace/std

tomek at codespeak.net tomek at codespeak.net
Fri May 30 13:55:02 CEST 2003


Author: tomek
Date: Fri May 30 13:55:01 2003
New Revision: 730

Modified:
   pypy/trunk/src/pypy/objspace/std/stringobject.py
Log:
ok


Modified: pypy/trunk/src/pypy/objspace/std/stringobject.py
==============================================================================
--- pypy/trunk/src/pypy/objspace/std/stringobject.py	(original)
+++ pypy/trunk/src/pypy/objspace/std/stringobject.py	Fri May 30 13:55:01 2003
@@ -58,24 +58,27 @@
         else:
             return W_StringObject(w_self.space, "")
 
-    def char_isspace(ch):
+    def _char_isspace(ch):
         return ord(ch) in (9, 10, 11, 12, 13, 32)  
- 
-    def isspace(w_self):
+
+    def is_generic(w_self, fun): 
         space = w_self.space   
         v = w_self._value
         if v.len == 0:
             return space.w_False
         if v.len == 1:
             c = v.charat(0)
-            return space.newbool(ord(c) in (9, 10, 11, 12, 13, 32))
+            return space.newbool(fun(c))
         else:
             res = 1
             for idx in range(v.len):
-                if not (ord(v.charat(idx)) in (9, 10, 11, 12, 13, 32)):
+                if not fun(v.charat(idx)):
                     return space.w_False
             return space.w_True
 
+    def isspace(w_self):
+       return is_generic(w_self, _char_isspace)
+
     def isdigit(w_self):
         pass
 


More information about the Pypy-commit mailing list