From 2d349eae8cb6f1f3b61838dca7cc989e9278be28 Mon Sep 17 00:00:00 2001 From: Dylan Baker Date: Wed, 7 Sep 2022 14:59:47 -0700 Subject: pylint: enable the set_membership plugin Which adds the `use-set-for-membership` check. It's generally faster in python to use a set with the `in` keyword, because it's a hash check instead of a linear walk, this is especially true with strings, where it's actually O(n^2), one loop over the container, and an inner loop of the strings (as string comparison works by checking that `a[n] == b[n]`, in a loop). Also, I'm tired of complaining about this in reviews, let the tools do it for me :) --- mesonbuild/modules/python.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'mesonbuild/modules/python.py') diff --git a/mesonbuild/modules/python.py b/mesonbuild/modules/python.py index 71a25d5..6bbfdb9 100644 --- a/mesonbuild/modules/python.py +++ b/mesonbuild/modules/python.py @@ -194,7 +194,7 @@ class PythonSystemDependency(SystemDependency, _PythonDependencyBase): return None elif self.platform == 'win32': return '32' - elif self.platform in ('win64', 'win-amd64'): + elif self.platform in {'win64', 'win-amd64'}: return '64' mlog.log(f'Unknown Windows Python platform {self.platform!r}') return None @@ -727,7 +727,7 @@ class PythonModule(ExtensionModule): # on various platforms, let's not give up just yet, if an executable # named python is available and has a compatible version, let's use # it - if not python.found() and name_or_path in ['python2', 'python3']: + if not python.found() and name_or_path in {'python2', 'python3'}: python = PythonExternalProgram('python') if python.found(): -- cgit v1.1