Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make slice generic #11637

Draft
wants to merge 13 commits into
base: main
Choose a base branch
from
Draft
15 changes: 9 additions & 6 deletions stdlib/builtins.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@ _SupportsAnextT = TypeVar("_SupportsAnextT", bound=SupportsAnext[Any], covariant
_AwaitableT = TypeVar("_AwaitableT", bound=Awaitable[Any])
_AwaitableT_co = TypeVar("_AwaitableT_co", bound=Awaitable[Any], covariant=True)
_P = ParamSpec("_P")
_StartT = TypeVar("_StartT", covariant=True, default=Any)
_StopT = TypeVar("_StopT", covariant=True, default=Any)
_StepT = TypeVar("_StepT", covariant=True, default=Any)

class object:
__doc__: str | None
Expand Down Expand Up @@ -914,17 +917,17 @@ class bool(int):
def __invert__(self) -> int: ...

@final
class slice:
class slice(Generic[_StartT, _StopT, _StepT]):
@property
def start(self) -> Any: ...
def start(self) -> _StartT: ...
@property
def step(self) -> Any: ...
def step(self) -> _StepT: ...
@property
def stop(self) -> Any: ...
def stop(self) -> _StopT: ...
@overload
def __new__(cls, stop: Any, /) -> Self: ...
def __new__(cls, stop: _StopT, /) -> Self: ...
@overload
def __new__(cls, start: Any, stop: Any, step: Any = ..., /) -> Self: ...
def __new__(cls, start: _StartT, stop: _StopT, step: _StepT = ..., /) -> Self: ...
def __eq__(self, value: object, /) -> bool: ...
__hash__: ClassVar[None] # type: ignore[assignment]
def indices(self, len: SupportsIndex, /) -> tuple[int, int, int]: ...
Expand Down
Loading