From 7ba56e06be674819a7c494d4db889fd0ce1727b9 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Mon, 6 Sep 2021 17:21:16 +0200 Subject: [PATCH] Python str.endswith() can take a tuple of alternatives https://docs.python.org/3/library/stdtypes.html#str.endswith One function call should be faster than three function calls per file. --- configure.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.py b/configure.py index 9327d6e5f5da06..6efb98c2316f08 100755 --- a/configure.py +++ b/configure.py @@ -1512,7 +1512,7 @@ def glob_to_var(dir_base, dir_sub, patch_dir): for ent in files: (path, dirs, files) = ent for file in files: - if file.endswith('.cpp') or file.endswith('.c') or file.endswith('.h'): + if file.endswith(('.cpp', '.c', '.h')): # srcfile uses "slash" as dir separator as its output is consumed by gyp srcfile = '%s/%s' % (dir_sub, file) if patch_dir: