[pypy-svn] rev 800 - pypy/trunk/src/pypy/objspace/std
mwh at codespeak.net
mwh at codespeak.net
Fri Jun 13 14:56:25 CEST 2003
Author: mwh
Date: Fri Jun 13 14:56:24 2003
New Revision: 800
Modified:
pypy/trunk/src/pypy/objspace/std/stringobject.py
pypy/trunk/src/pypy/objspace/std/stringtype.py
Log:
nasty implementations of str_ljust & str_rjust
(needed for dis-goal.py)
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 Jun 13 14:56:24 2003
@@ -169,6 +169,21 @@
W_StringType.str_join.register(str_join, W_StringObject, W_ANY)
+def str_ljust(space, w_str, w_arg):
+ # XXX look away for three lines, please :-) -- mwh
+ u = space.unwrap
+ w = space.wrap
+ return w(u(w_str).ljust(u(w_arg)))
+
+W_StringType.str_ljust.register(str_ljust, W_StringObject, W_ANY)
+
+def str_rjust(space, w_str, w_arg):
+ # XXX and another three -- mwh
+ u = space.unwrap
+ w = space.wrap
+ return w(u(w_str).rjust(u(w_arg)))
+
+W_StringType.str_rjust.register(str_rjust, W_StringObject, W_ANY)
def str_unwrap(space, w_str):
return w_str._value.value()
Modified: pypy/trunk/src/pypy/objspace/std/stringtype.py
==============================================================================
--- pypy/trunk/src/pypy/objspace/std/stringtype.py (original)
+++ pypy/trunk/src/pypy/objspace/std/stringtype.py Fri Jun 13 14:56:24 2003
@@ -16,6 +16,8 @@
str_islower = MultiMethod('islower', 1)
str_istitle = MultiMethod('istitle', 1)
str_isalnum = MultiMethod('isalnum', 1)
+ str_ljust = MultiMethod('ljust', 2)
+ str_rjust = MultiMethod('rjust', 2)
# XXX we'll worry about the __new__/__init__ distinction later
def stringtype_new(space, w_stringtype, w_args, w_kwds):
More information about the Pypy-commit
mailing list