Project

General

Profile

« Previous | Next » 

Revision 4083

util.py: list_subset(): Fixed bug where using '+' to append the rest of the list didn't work if '+' was the first index, because max() cannot be called on an empty list

View differences:

lib/util.py
137 137
    for i, idx in enumerate(idxs):
138 138
        if idx == '+':
139 139
            prev_idxs = idxs[:i] # excluding the current value, which is '+'
140
            subset += list_[max(prev_idxs)+1:]
140
            if prev_idxs: subset_start = max(prev_idxs)+1
141
            else: subset_start = 0
142
            subset += list_[subset_start:]
141 143
        else:
142 144
            value = list_get(list_, idx, default)
143 145
            if value is not subset_skip: subset.append(value)

Also available in: Unified diff