This syntax is not supported in python2.4, and is trivial to rewrite. Change-Id: Ibbf46cd0276445c0cfb016c7b9b8e845125b4cad
@@ -68,12 +68,14 @@ except ImportError:
# Implementation of permutations from Python 2.6 documentation:
# http://docs.python.org/2.6/library/itertools.html#itertools.permutations
# Copyright (c) 2001-2010 Python Software Foundation; All Rights Reserved
+ # Modified syntax slightly to run under Python 2.4.
def permutations(iterable, r=None):
# permutations('ABCD', 2) --> AB AC AD BA BC BD CA CB CD DA DB DC
# permutations(range(3)) --> 012 021 102 120 201 210
pool = tuple(iterable)
n = len(pool)
- r = n if r is None else r
+ if r is None:
+ r = n
if r > n:
return
indices = range(n)