Don't use itertools.product any more
authorKonstantin Stepanov <kstep@p-nut.info>
Sat, 27 Nov 2010 13:38:05 +0000 (15:38 +0200)
committerKonstantin Stepanov <kstep@p-nut.info>
Sat, 27 Nov 2010 13:38:05 +0000 (15:38 +0200)
dbuscron/parser.py

index f025709..46df350 100644 (file)
@@ -2,18 +2,15 @@ from __future__ import with_statement
 import re
 from dbuscron.bus import DbusBus
 
-try:
-    from itertools import product
-except ImportError:
-    def product(*args):
-        if args:
-            head, tail = args[0], args[1:]
-            for h in head:
-                for t in product(*tail):
-                    yield (h,) + t
-    
-        else:
-            yield ()
+def product(*args):
+    if args:
+        head, tail = args[0], args[1:]
+        for h in head:
+            for t in product(*tail):
+                yield (h,) + t
+
+    else:
+        yield ()
 
 class CrontabParser(object):
     __fields_sep = re.compile(r'\s+')