def intervals(nms  # list of indices
              ):
    """
    Return intervals between numbers.

    ::

        >>> intervals([1, 2, 3])==[(1, 2), (2, 3)]
        True

    """
    return list(zip(nms[:], nms[1:]))