From 02e69baba63aa3b772a9191bb7810f0cabd4e6b8 Mon Sep 17 00:00:00 2001 From: Lukas Geiger Date: Mon, 22 Jun 2020 11:44:38 -0700 Subject: [PATCH] Replace list comprehension with generator expresion when calling any() (#604) This allows `any()` to return early without needing to iterate over the entire list. Resolves #604 PiperOrigin-RevId: 317701319 --- pytype/pyi/parser.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pytype/pyi/parser.py b/pytype/pyi/parser.py index 3f73e851d..aee6fcbf7 100644 --- a/pytype/pyi/parser.py +++ b/pytype/pyi/parser.py @@ -982,7 +982,7 @@ def new_function( # Extract out abstractmethod and coroutine decorators, there should be at # most one remaining decorator. def _check_decorator(decorators, decorator_set): - exists = any([x in decorators for x in decorator_set]) + exists = any(x in decorators for x in decorator_set) if exists: decorators -= decorator_set return exists