[Python-checkins] r78562 - python/trunk/Doc/includes/minidom-example.py

andrew.kuchling python-checkins at python.org
Mon Mar 1 21:11:57 CET 2010


Author: andrew.kuchling
Date: Mon Mar  1 21:11:57 2010
New Revision: 78562

Log:
#7637: avoid repeated-concatenation antipattern in example

Modified:
   python/trunk/Doc/includes/minidom-example.py

Modified: python/trunk/Doc/includes/minidom-example.py
==============================================================================
--- python/trunk/Doc/includes/minidom-example.py	(original)
+++ python/trunk/Doc/includes/minidom-example.py	Mon Mar  1 21:11:57 2010
@@ -19,11 +19,11 @@
 dom = xml.dom.minidom.parseString(document)
 
 def getText(nodelist):
-    rc = ""
+    rc = []
     for node in nodelist:
         if node.nodeType == node.TEXT_NODE:
-            rc = rc + node.data
-    return rc
+            rc.append(node.data)
+    return ''.join(rc)
 
 def handleSlideshow(slideshow):
     print "<html>"


More information about the Python-checkins mailing list