def frange(limit1, limit2 = None, increment = 1.):
  """
  Range function that accepts floats (and integers).

  Usage:
  frange(-2, 2, 0.1)
  frange(10)
  frange(10, increment = 0.5)

  The returned value is a list.
  """

  if limit2 is None:    limit2, limit1 = limit1, 0.
  else:    limit1 = float(limit1)
  result = []
  if (limit1 != limit2):
    n = 0
    if (increment < 0.):
      while True:
        value = limit1 + n * increment
        if (value <= limit2):
          break
        result.append(value)
        n += 1
    else:
      while True:
        value = limit1 + n * increment
        if (value >= limit2):
          break
        result.append(value)
        n += 1
  return result