diff options
author | Emilio Pozuelo Monfort <pochu@debian.org> | 2020-07-16 16:04:58 +0200 |
---|---|---|
committer | Emilio Pozuelo Monfort <pochu@debian.org> | 2020-07-29 10:20:41 +0200 |
commit | 39b0f8367c2b1d530d46284d5c088c4914431a56 (patch) | |
tree | 72a88dba5ed73b54360944aad8e922d596aa5f5e /lib | |
parent | 3dedb21b13704b106b0024746e74c2406ed3761a (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.py | 10 |
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): |