def getTimes(from_, to, incr=1.0, frommid=1):
    """Returns a list of "times" in the given range and incr.
    If frommid=1, then returns in increasing distance from midpoint.
    Examples:
    >>> getTimes(-5, 5, 1)
    [0, -1, 1, -2, 2, -3, 3, -4, 4, -5, 5]
    >>> getTimes(-5, 5, 1, 0)
    [-5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5]
    >>> getTimes(-120.0, 100.0, 25.5)
    [-18.0, 7.5, -43.5, 33.0, -69.0, 58.5, -94.5, 84.0, -120.0]
    """
    ret = []
    i = from_
    while i <= to:
        ret.append(i)
        i += incr
    if frommid:
        mid = (from_ + to)/2
        ret = sorted(ret, key=lambda t: abs(t-mid))
    return ret