]> granicus.if.org Git - python/commitdiff
#7637: avoid repeated-concatenation antipattern in example
authorAndrew M. Kuchling <amk@amk.ca>
Mon, 1 Mar 2010 20:11:57 +0000 (20:11 +0000)
committerAndrew M. Kuchling <amk@amk.ca>
Mon, 1 Mar 2010 20:11:57 +0000 (20:11 +0000)
Doc/includes/minidom-example.py

index c30c4e08a9425b930c9d98a6edbd868245e2f4d6..4bca949f71fdbbcf7c463e8b21991df0c2606790 100644 (file)
@@ -19,11 +19,11 @@ document = """\
 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>"