From 5678468c2cc1f4639c68a95fb71f8212c846459b Mon Sep 17 00:00:00 2001 From: Dylan Baker Date: Mon, 22 Apr 2019 15:54:16 -0700 Subject: Don't use len() to test for container emptiness I ran the numbers once before (it's in the meson history) but it's *much* faster to *not* use len for testing if a container is empty or not. --- mesonbuild/mesonmain.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'mesonbuild/mesonmain.py') diff --git a/mesonbuild/mesonmain.py b/mesonbuild/mesonmain.py index f80dfdd..4326c20 100644 --- a/mesonbuild/mesonmain.py +++ b/mesonbuild/mesonmain.py @@ -110,7 +110,7 @@ class CommandLineParser: # If first arg is not a known command, assume user wants to run the setup # command. known_commands = list(self.commands.keys()) + ['-h', '--help'] - if len(args) == 0 or args[0] not in known_commands: + if not args or args[0] not in known_commands: args = ['setup'] + args # Hidden commands have their own parser instead of using the global one -- cgit v1.1