code: def from_range(cls, data, name=None, dtype=None, **kwargs):
          
          if not isinstance(data, range):
              raise TypeError(
                  '{0}(...) must be called with object coercible to a '
                  'range, {1} was passed'.format(cls.__name__, repr(data)))
  
          start, stop, step = data.start, data.stop, data.step
          return RangeIndex(start, stop, step, dtype=dtype, name=name, **kwargs)
docs: Create RangeIndex from a range object.