碾平 list::

        >>> a = [1, 2, [3, 4], [[5, 6], [7, 8]]]
        >>> flatten_list(a)
        [1, 2, 3, 4, 5, 6, 7, 8]

    :param multiply_list: 混淆的多层列表
    :return: 单层的 list
761945
def flatten_list(multiply_list):
    
    if isinstance(multiply_list, list):
        return [rv for l in multiply_list for rv in flatten_list(l)]
    else:
        return [multiply_list]
795146
def flatten(list_to_flatten):
    """"""

    def genflatten(lst):
        for elem in lst:
            if isinstance(elem, (list, tuple)):
                for x in flatten(elem):
                    yield x
            else:
                yield elem

    return list(genflatten(list_to_flatten))
1368742
def flatten(nested, containers=(list, tuple)):
    
    for item in nested:
        if hasattr(item, "next") or isinstance(item, containers):
            for subitem in flatten(item):
                yield subitem
        else:
            yield item
1084529
function flatten(list) {
    return list.reduce(function (acc, item) {
        if (Array.isArray(item)) {
            return acc.concat(flatten(item));
        }
        else {
            return acc.concat(item);
        }
    }, []);
}
171108
def listify(val, return_type=tuple):
    
    # TODO: flatlistify((1, 2, 3), 4, (5, 6, 7))
    if val is None:
        return return_type()
    elif isiterable(val):
        return return_type(val)
    else:
        return return_type((val, ))
1066114
def flatten_list(x: List[Any]) -> List[Any]:
      # noqa
    return [item for sublist in x for item in sublist]
534435
def concatenate_lists(*layers, **kwargs):  # pragma: no cover
    
    if not layers:
        return noop()
    drop_factor = kwargs.get("drop_factor", 1.0)
    ops = layers[0].ops
    layers = [chain(layer, flatten) for layer in layers]
    concat = concatenate(*layers)

    def concatenate_lists_fwd(Xs, drop=0.0):
        drop *= drop_factor
        lengths = ops.asarray([len(X) for X in Xs], dtype="i")
        flat_y, bp_flat_y = concat.begin_update(Xs, drop=drop)
        ys = ops.unflatten(flat_y, lengths)

        def concatenate_lists_bwd(d_ys, sgd=None):
            return bp_flat_y(ops.flatten(d_ys), sgd=sgd)

        return ys, concatenate_lists_bwd

    model = wrap(concatenate_lists_fwd, concat)
    return model
1304049
def multiply(**kwargs):
    
    result = 1
    for i in list(kwargs.values()):
        if not i:
            # If one value is null, we return null.
            return i
        result *= i
    return result
469610
function flattenList(list) {
  // Make a copy, so the original tensor is not modified.
  list = [].concat(list);

  // Note that i must be checked against the length of the list each time through the loop, as the
  // list is modified within the iterations.
  for (let i = 0; i < list.length; i++) {
    if (Array.isArray(list[i])) {
      // Replace the item with the flattened version of the item (using the ... operator).
      // Replace with the items and backtrack 1 position
      list.splice(i, 1, ...list[i]);

      // Decrement i to look at the element again; we'll keep looking at this i index, until
      // the most deeply nested item has been flattened.
      i--;
    }
  }

  return list;
}
827463
def flatten(list_of_lists):
  
  ret = []
  for lst in list_of_lists:
    if not isinstance(lst, list):
      raise ValueError('%r is not a list' % lst)
    ret.extend(lst)
  return ret
19954
def flatten_items(items, recurse=False):
    

    if not items:
        return items
    elif not hasattr(items, '__iter__'):
        return items
    elif isinstance(items, _flattened_types):
        return items

    flattened = []
    for item in items:
        if item and hasattr(item, '__iter__') and not isinstance(item, _flattened_types):
            flattened.extend(flatten_items(item, True) if recurse else item)
        else:
            flattened.append(item)

    return type(items)(flattened) if isinstance(items, _flatten_types) else flattened
255994
def p_lconst_list(self, p):
        ''''''
        if len(p) == 4:
            p[1].append(p[3])
            p[0] = p[1]
        elif len(p) == 2:
            p[0] = [p[1]]
971734
def multiply(self, multiplicator):
        
        result = Matrix(self.get_width(), self.get_height())
        for row in xrange(self.get_height()):
            for col in xrange(self.get_width()):
                result.set_value(col, row, self.get_value(col, row) * multiplicator)
        return result
407565
public static <T> List<T> flatten(Collection<List<T>> nestedList) {
    List<T> result = new ArrayList<T>();
    for (List<T> list : nestedList) {
      result.addAll(list);
    }
    return result;
  }
243970
def flatten(nested_list):
    ''''''
    return_list = []
    for i in nested_list:
        if isinstance(i,list):
            return_list += flatten(i)
        else:
            return_list.append(i)
    return return_list
574793
def flatten(nested_list: list) -> list:
    """"""
    return list(sorted(filter(lambda y: y is not None,
                              list(map(lambda x: (nested_list.extend(x)  # noqa: T484
                                                  if isinstance(x, list) else x),
                                       nested_list)))))
1363077
def uniqify(list_):
  ""
  a=[]
  for x in list_:
    if x not in a: a.append(x)
  return a