From 7aee588918b4fb17de681bc31eca177304c3e978 Mon Sep 17 00:00:00 2001 From: Nicolas Grilly Date: Thu, 23 May 2013 18:37:30 +0200 Subject: [PATCH] Idiomatic Python: use in operator instead of method find --- lib/ansible/inventory/__init__.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/ansible/inventory/__init__.py b/lib/ansible/inventory/__init__.py index 821145871af..3d407a92c02 100644 --- a/lib/ansible/inventory/__init__.py +++ b/lib/ansible/inventory/__init__.py @@ -63,7 +63,7 @@ class Inventory(object): self._subset = None if isinstance(host_list, basestring): - if host_list.find(",") != -1: + if "," in host_list: host_list = host_list.split(",") host_list = [ h for h in host_list if h and h.strip() ] @@ -72,8 +72,8 @@ class Inventory(object): all = Group('all') self.groups = [ all ] for x in host_list: - if x.find(":") != -1: - tokens = x.split(":",1) + if ":" in x: + tokens = x.split(":", 1) all.add_host(Host(tokens[0], tokens[1])) else: all.add_host(Host(x))