[pypy-commit] lang-scheme default: Remove some code dublication

boemmels noreply at buildbot.pypy.org
Sun Sep 4 19:55:49 CEST 2011


Author: Juergen Boemmels <boemmels at web.de>
Branch: 
Changeset: r3:599eea81fab0
Date: 2011-09-04 19:08 +0200
http://bitbucket.org/pypy/lang-scheme/changeset/599eea81fab0/

Log:	Remove some code dublication

diff --git a/scheme/object.py b/scheme/object.py
--- a/scheme/object.py
+++ b/scheme/object.py
@@ -226,15 +226,7 @@
         self.cdr = cdr
 
     def to_string(self):
-        car = self.car.to_string()
-        cdr = self.cdr
-        if isinstance(cdr, W_Pair): #proper list
-            return "(" + car + " " + cdr.to_lstring() + ")"
-        elif cdr is w_nil: #one element proper list
-            return "(" + car + ")"
-
-        #dotted list/pair
-        return "(" + car + " . " + cdr.to_string() + ")"
+        return "(" + self.to_lstring() + ")"
 
     def to_lstring(self):
         car = self.car.to_string()


More information about the pypy-commit mailing list