[pypy-svn] r50413 - pypy/branch/ghop-ropes-classes/pypy/rlib

vinogradov at codespeak.net vinogradov at codespeak.net
Mon Jan 7 06:27:39 CET 2008


Author: vinogradov
Date: Mon Jan  7 06:27:37 2008
New Revision: 50413

Modified:
   pypy/branch/ghop-ropes-classes/pypy/rlib/ropewrapper.py
Log:
Implement __str__ method for RopeString and RopeUnicode

Modified: pypy/branch/ghop-ropes-classes/pypy/rlib/ropewrapper.py
==============================================================================
--- pypy/branch/ghop-ropes-classes/pypy/rlib/ropewrapper.py	(original)
+++ pypy/branch/ghop-ropes-classes/pypy/rlib/ropewrapper.py	Mon Jan  7 06:27:37 2008
@@ -76,6 +76,9 @@
     def __iter__(self):
         return RopeStringIterator(self._node)
     
+    def __str__(self):
+        return self._node.flatten_string()
+    
     def encode(self, encoding, errors='strict'):
         s = self._node.flatten_string()
         result = s.encode(encoding, errors)
@@ -127,6 +130,9 @@
     def __iter__(self):
         return RopeUnicodeIterator(self._node)
     
+    def __str__(self):
+        return self._node.flatten_unicode()
+    
     def encode(self, encoding, errors = 'strict'):
         result = None
         



More information about the Pypy-commit mailing list