summaryrefslogtreecommitdiffstats
path: root/lib
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
commit39b0f8367c2b1d530d46284d5c088c4914431a56 (patch)
tree72a88dba5ed73b54360944aad8e922d596aa5f5e /lib
parent3dedb21b13704b106b0024746e74c2406ed3761a (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.
Diffstat (limited to 'lib')
-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