code: def listclip(list_, num, fromback=False):
      r
      if num is None:
          num_ = len(list_)
      else:
          num_ = min(len(list_), num)
      if fromback:
          sublist = list_[-num_:]
      else:
          sublist = list_[:num_]
      return sublist
docs: r"""
      DEPRICATE: use slices instead
  
      Args:
          list_ (list):
          num (int):
  
      Returns:
          sublist:
  
      CommandLine:
          python -m utool.util_list --test-listclip
  
      Example1:
          >>> # ENABLE_DOCTEST
          >>> import utool as ut
          >>> # build test data
          >>> list_ = [1, 2, 3, 4, 5]
          >>> result_list = []
          >>> # execute function
          >>> num = 3
          >>> result_list += [ut.listclip(list_, num)]
          >>> num = 9
          >>> result_list += [ut.listclip(list_, num)]
          >>> # verify results
          >>> result = ut.repr4(result_list)
          >>> print(result)
          [
              [1, 2, 3],
              [1, 2, 3, 4, 5],
          ]
  
      Example2:
          >>> # ENABLE_DOCTEST
          >>> import utool as ut
          >>> # build test data
          >>> list_ = [1, 2, 3, 4, 5]
          >>> result_list = []
          >>> # execute function
          >>> num = 3
          >>> result = ut.listclip(list_, num, fromback=True)
          >>> print(result)
          [3, 4, 5]