original_docstring: Flattens an arbitrarly nested list into a flat list.
docstring: Flattens an arbitrarly nested list into a flat list.
docstring_tokens: Flattens an arbitrarly nested list into a flat list .
code: def flatten(lst):
      """Flattens an arbitrarly nested list into a flat list."""
  
      def f(acc, x):
          """Checks if `x` is a list and if so, flattens it."""
  
          # If param is a list, call flatten recursively, otherwise append item
          if isinstance(x, list):
              return acc + flatten(x)
          else:
              return acc + [x]
  
      # Flatten items in list by reducing over it with function f()
      return reduce(f, lst, [])
code_tokens: def flatten ( lst ) : def f ( acc , x ) : """Checks if `x` is a list and if so, flattens it.""" if isinstance ( x , list ) : return acc + flatten ( x ) else : return acc + [ x ] return reduce ( f , lst , [ ] )
short_docstring: Flattens an arbitrarly nested list into a flat list.
short_docstring_tokens: Flattens an arbitrarly nested list into a flat list .
comment: """Flattens an arbitrarly nested list into a flat list."""$SEP$"""Checks if `x` is a list and if so, flattens it."""$SEP$# If param is a list, call flatten recursively, otherwise append item$SEP$# Flatten items in list by reducing over it with function f()