Skip to content

Commit

Permalink
Replace list comprehension with generator expresion when calling any() (
Browse files Browse the repository at this point in the history
#604)

This allows `any()` to return early without needing to iterate over the entire list.

Resolves #604

PiperOrigin-RevId: 317701319
  • Loading branch information
lgeiger authored and rchen152 committed Jun 23, 2020
1 parent 16ac66c commit 02e69ba
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pytype/pyi/parser.py
Expand Up @@ -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
Expand Down

0 comments on commit 02e69ba

Please sign in to comment.