fhdl/tools/flat_iteration: generalize
authorSebastien Bourdeauducq <sebastien@milkymist.org>
Sat, 9 Mar 2013 22:03:15 +0000 (23:03 +0100)
committerSebastien Bourdeauducq <sebastien@milkymist.org>
Sat, 9 Mar 2013 22:03:15 +0000 (23:03 +0100)
migen/fhdl/tools.py

index f9cb67c74ee99ee6960d3099ecb0f805dbe60d31..f7b50fd7dbdade8172c33624d80125e6eba983be 100644 (file)
@@ -1,10 +1,12 @@
+import collections
+
 from migen.fhdl.structure import *
 from migen.fhdl.structure import _Operator, _Slice, _Assign, _ArrayProxy
 from migen.fhdl.visit import NodeVisitor, NodeTransformer
 
 def flat_iteration(l):
        for element in l:
-               if isinstance(element, (list, tuple)):
+               if isinstance(element, collections.Iterable):
                        for element2 in flat_iteration(element):
                                yield element2
                else: