def flatten(self, args): new_symbol = [x for x in args if not self.is_constant(x.command)] # TODO - betterized flattening - taking into account types? new_const = ''.join([x.command for x in args if self.is_constant(x.command)]) if new_const: c = Command() c.command = new_const new_symbol.append(c) return new_symbol
def flatten(self, args): new_symbol = [x for x in args if not self.is_constant(x.command)] # TODO - betterized flattening - taking into account types? new_const = ''.join( [x.command for x in args if self.is_constant(x.command)]) if new_const: c = Command() c.command = new_const new_symbol.append(c) return new_symbol