From 7d9689c1c5223020c6f082e67aab3b2072ed955e Mon Sep 17 00:00:00 2001 From: Abhijit Menon-Sen Date: Fri, 31 Jul 2015 12:36:48 +0530 Subject: [PATCH] Slice ascii_letters directly instead of using 'for x in range()' --- lib/ansible/inventory/expand_hosts.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ansible/inventory/expand_hosts.py b/lib/ansible/inventory/expand_hosts.py index 71f6a6536c..0d63ba08bb 100644 --- a/lib/ansible/inventory/expand_hosts.py +++ b/lib/ansible/inventory/expand_hosts.py @@ -103,7 +103,7 @@ def expand_hostname_range(line = None): i_end = string.ascii_letters.index(end) if i_beg > i_end: raise errors.AnsibleError("host range must have begin <= end") - seq = [string.ascii_letters[i] for i in range(i_beg, i_end+1, int(step))] + seq = list(string.ascii_letters[i_beg:i_end+1:int(step)]) except ValueError: # not an alpha range seq = range(int(beg), int(end)+1, int(step))