aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEli Schwartz <eschwartz@archlinux.org>2023-02-01 16:52:26 -0500
committerNirbheek Chauhan <nirbheek@centricular.com>2023-02-19 02:55:58 +0530
commit4b4e516e1684abdc201cd7b8c4fb2c3e28db1ccd (patch)
tree1ca7effb9cc3bffe7a8debe16a28d5586b6431cd
parent9dbaeae09e99fc5533f67786207ad9dd737f5954 (diff)
downloadmeson-4b4e516e1684abdc201cd7b8c4fb2c3e28db1ccd.zip
meson-4b4e516e1684abdc201cd7b8c4fb2c3e28db1ccd.tar.gz
meson-4b4e516e1684abdc201cd7b8c4fb2c3e28db1ccd.tar.bz2
pylint 2.16: join iterables without repeated append
We do += style joining in a loop, but we could just join with `''.join()` which is faster, neater, and simpler.
-rw-r--r--mesonbuild/compilers/mixins/clike.py4
1 files changed, 1 insertions, 3 deletions
diff --git a/mesonbuild/compilers/mixins/clike.py b/mesonbuild/compilers/mixins/clike.py
index ed485d2..d44dd4d 100644
--- a/mesonbuild/compilers/mixins/clike.py
+++ b/mesonbuild/compilers/mixins/clike.py
@@ -882,9 +882,7 @@ class CLikeCompiler(Compiler):
if extra_args is None:
extra_args = []
# Create code that accesses all members
- members = ''
- for member in membernames:
- members += f'foo.{member};\n'
+ members = ''.join(f'foo.{member};\n' for member in membernames)
t = f'''{prefix}
void bar(void) {{
{typename} foo;