Simplify the non-CDATA path of tostring.escape.

This commit is contained in:
Emmanuel Gil Peyrot 2019-01-09 15:03:05 +01:00
parent 4b482477e2
commit 15c6b775ff

View file

@ -146,10 +146,7 @@ def escape(text, use_cdata=False):
'"': '"'}
if not use_cdata:
text = list(text)
for i, c in enumerate(text):
text[i] = escapes.get(c, c)
return ''.join(text)
return ''.join(escapes.get(c, c) for c in text)
else:
escape_needed = False
for c in text: