[pypy-svn] rev 721 - pypy/trunk/src/pypy/objspace/std
tomek at codespeak.net
tomek at codespeak.net
Fri May 30 12:51:00 CEST 2003
Author: tomek
Date: Fri May 30 12:51:00 2003
New Revision: 721
Modified:
pypy/trunk/src/pypy/objspace/std/stringobject.py
Log:
isspace added
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 12:51:00 2003
@@ -57,6 +57,23 @@
return W_StringObject(w_self.space, res.value())
else:
return W_StringObject(w_self.space, "")
+
+ def isspace(self):
+ space = self.space
+ v = 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))
+ else:
+ res = 1
+ for idx in range(v.len):
+ if not (ord(v.charat(idx)) in (9, 10, 11, 12, 13, 32)):
+ return space.w_False
+ return space.w_True
+
+ isspace = implmethod().register(isspace)
join = implmethod().register(join, W_ANY)
split = implmethod()
More information about the Pypy-commit
mailing list