Repository: pandas-dev/pandas-stubs (language: python)

Issue:
`pd.RangeIndex` should accept `range` as the first argument
**Describe the bug**
Both according to the docs and the implementation it is valid to pass a python `range` object as the first argument to `pd.RangeIndex`

**To Reproduce**
```python
import pandas as pd

pd.RangeIndex(range(5))  # mypy: arg-type – Argument 1 to "RangeIndex" has incompatible type "range"
```


**Please complete the following information:**
 - OS: Linux (OpenSUSE Tumbleweed)
 - Python 3.10
 - mypy 1.0.1
 - pandas-stubs 2.0.1.230501



Discussion / hints:
Would need to add `range` here https://github.com/pandas-dev/pandas-stubs/blob/9c301b33b746e28401868b788364cecd00a34655/pandas-stubs/core/indexes/range.pyi#L30 (and probably also for `__new__`)
> (and probably also for `__new__`)

We actually don't need `__new__()` here, so we should delete it.

Fix patch:
diff --git a/pandas-stubs/core/indexes/range.pyi b/pandas-stubs/core/indexes/range.pyi
index 16b99ade..e2b3bf7f 100644
--- a/pandas-stubs/core/indexes/range.pyi
+++ b/pandas-stubs/core/indexes/range.pyi
@@ -15,22 +15,13 @@ from pandas._typing import (
 class RangeIndex(Index[int]):
     def __new__(
         cls,
-        start: int | RangeIndex = ...,
+        start: int | RangeIndex | range = ...,
         stop: int = ...,
         step: int = ...,
         dtype=...,
         copy: bool = ...,
         name=...,
     ): ...
-    def __init__(
-        self,
-        start: int | RangeIndex = ...,
-        stop: int = ...,
-        step: int = ...,
-        dtype=...,
-        copy: bool = ...,
-        name=...,
-    ) -> None: ...
     @classmethod
     def from_range(cls, data, name=..., dtype=...): ...
     def __reduce__(self): ...


Test patch:
diff --git a/tests/test_indexes.py b/tests/test_indexes.py
index d151ba48..46ec843a 100644
--- a/tests/test_indexes.py
+++ b/tests/test_indexes.py
@@ -912,6 +912,12 @@ def test_getitem() -> None:
     check(assert_type(i0[[0, 2]], "pd.Index[str]"), pd.Index, str)
 
 
+def test_range_index_range() -> None:
+    """Test that pd.RangeIndex can be initialized from range."""
+    iri = pd.RangeIndex(range(5))
+    check(assert_type(iri, pd.RangeIndex), pd.RangeIndex, int)
+
+
 def test_multiindex_dtypes():
     # GH-597
     mi = pd.MultiIndex.from_tuples([(1, 2.0), (2, 3.0)], names=["foo", "bar"])