diff options
author | Kenneth Graunke <kenneth@whitecape.org> | 2012-02-17 01:38:49 -0800 |
---|---|---|
committer | Kenneth Graunke <kenneth@whitecape.org> | 2012-02-24 09:36:21 -0800 |
commit | f53316137684e55393b72c0bfa1b62516b8281a3 (patch) | |
tree | 7db52af1b86885e08bf7b6a5d3bf2222f494b7d2 /piglit-run.py | |
parent | 4fbe147b5817b2ba0fe44fe9db96a2d05288aeea (diff) |
piglit-run.py: Use list.append(item) instead of list[:0] = [item].
list[:0] = [item] is a strange way to add an item to a list.
1. It forces the list to be copied, which can be inefficient.
2. It produces a strange ordering:
>>> x = [1, 2, 3]
>>> x[:0] = [4]
>>> x
[4, 1, 2, 3]
...whereas list.append(item) produces [1, 2, 3, 4].
3. Most importantly, list.append is easier to understand at a glance.
Reported-by: Paul Berry <stereotype441@gmail.com>
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Diffstat (limited to 'piglit-run.py')
-rwxr-xr-x | piglit-run.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/piglit-run.py b/piglit-run.py index f67984f5d..b6f8bf5f4 100755 --- a/piglit-run.py +++ b/piglit-run.py @@ -88,9 +88,9 @@ def main(): elif name in ('-d', '--dry-run'): env.execute = False elif name in ('-t', '--tests'): - env.filter[:0] = [re.compile(value)] + env.filter.append(re.compile(value)) elif name in ('-x', '--exclude-tests'): - env.exclude_filter[:0] = [re.compile(value)] + env.exclude_filter.append(re.compile(value)) elif name in ('-n', '--name'): OptionName = value elif name in ('-c, --concurrent'): |