summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEmilio Pozuelo Monfort <pochu@debian.org>2020-07-16 16:04:58 +0200
committerEmilio Pozuelo Monfort <pochu@debian.org>2020-07-29 10:20:41 +0200
commitc7cd4e77570aae047f2f6df201f8bb35659ecbf8 (patch)
tree4472fb7dcabb0583649603e51b9233b2d365af88
parent6af514f68a252b9e2770a58cc0313d2d9593f4f5 (diff)
web_support.py: make_list: don't subscript the list
We may get objects that are not subscriptable in py3, such as map objects, so just iterate over the whole object and pop the last separator instead.
-rw-r--r--lib/python/web_support.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/python/web_support.py b/lib/python/web_support.py
index 50d62757e8..1ad6a7f51f 100644
--- a/lib/python/web_support.py
+++ b/lib/python/web_support.py
@@ -527,11 +527,11 @@ def make_list(lst, separator=", "):
assert not isstring(lst)
c = []
if lst:
- append = c.append
- for e in lst[:-1]:
- append(e)
- append(separator)
- append(lst[-1])
+ for e in lst:
+ c.append(e)
+ c.append(separator)
+ # pop the final separator
+ c.pop()
return Compose(c)
class InvalidPath(Exception):

© 2014-2024 Faster IT GmbH | imprint | privacy policy