diff options
author | Dylan Baker <dylan@pnwbakers.com> | 2022-09-07 14:59:47 -0700 |
---|---|---|
committer | Eli Schwartz <eschwartz@archlinux.org> | 2022-11-30 16:23:29 -0500 |
commit | 2d349eae8cb6f1f3b61838dca7cc989e9278be28 (patch) | |
tree | bc8d6325543e0df74b16941996f07797a746a2f6 /mesonbuild/modules/python.py | |
parent | 50f35039e7df321a309ee45db57d37635bf53ce3 (diff) | |
download | meson-2d349eae8cb6f1f3b61838dca7cc989e9278be28.zip meson-2d349eae8cb6f1f3b61838dca7cc989e9278be28.tar.gz meson-2d349eae8cb6f1f3b61838dca7cc989e9278be28.tar.bz2 |
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 :)
Diffstat (limited to 'mesonbuild/modules/python.py')
-rw-r--r-- | mesonbuild/modules/python.py | 4 |
1 files changed, 2 insertions, 2 deletions
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(): |