summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilipp Hahn <hahn@univention.de>2018-11-20 10:16:20 +0100
committerJano Tomko <jtomko@redhat.com>2020-09-01 13:26:01 +0000
commit4b798e340585909f9f52ef98222778b3839d7ad1 (patch)
tree382d0cef6f9533a949ed58d6363009a55c116e6f
parent879dae7483bb955f421eea6b1d6d4f32f4f8abd0 (diff)
downloadlibvirt-python-4b798e340585909f9f52ef98222778b3839d7ad1.tar.gz
generator: Simplify string concatentaion
by using ''.join() instead of concatenating string fragments in a loop, which is slower as it required re-hashing the string multiple times. Signed-off-by: Philipp Hahn <hahn@univention.de>
-rwxr-xr-xgenerator.py8
1 files changed, 2 insertions, 6 deletions
diff --git a/generator.py b/generator.py
index 0e7e02c..742bd74 100755
--- a/generator.py
+++ b/generator.py
@@ -190,15 +190,11 @@ class docParser(xml.sax.handler.ContentHandler):
self.function_return_info,
self.function_return_field]
elif tag == 'info':
- str = ''
- for c in self._data:
- str = str + c
+ str = ''.join(self._data)
if self.in_function == 1:
self.function_descr = str
elif tag == 'cond':
- str = ''
- for c in self._data:
- str = str + c
+ str = ''.join(self._data)
if self.in_function == 1:
self.function_cond = str