diff options
Diffstat (limited to 'Tools/compiler')
-rw-r--r-- | Tools/compiler/compiler/misc.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/Tools/compiler/compiler/misc.py b/Tools/compiler/compiler/misc.py index a281c10..dae42d4 100644 --- a/Tools/compiler/compiler/misc.py +++ b/Tools/compiler/compiler/misc.py @@ -1,3 +1,14 @@ +import types + +def flatten(tup): + elts = [] + for elt in tup: + if type(elt) == types.TupleType: + elts = elts + flatten(elt) + else: + elts.append(elt) + return elts + class Set: def __init__(self): self.elts = {} |