8000 More precise type hints for `slice` constructor by randolf-scholz · Pull Request #12899 · python/typeshed · GitHub
[go: up one dir, main page]

Skip to content

More precise type hints for slice constructor #12899

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

Closed
Prev Previous commit
Next Next commit
more simplification
  • Loading branch information
randolf-scholz committed Oct 25, 2024
commit 72e94b7b3a18ac2aa2656e15ef4596cb29aa6d29
9 changes: 4 additions & 5 deletions stdlib/builtins.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -946,21 +946,20 @@ class slice(Generic[_StartT_co, _StopT_co, _StepT_co]):
def step(self) -> _StepT_co: ...
@property
def stop(self) -> _StopT_co: ...
# generic slice --------------------------------------------------------------------
@overload # 2x None
def __new__(cls, start: None, stop: None = ..., step: None = ..., /) -> slice: ...
# unary overloads ------------------------------------------------------------------
@overload # 1x None
def __new__(cls, stop: None, /) -> slice: ...
@overload # 0x None
def __new__(cls, stop: _T2, /) -> slice[_T2 | None]: ...
# binary overloads -----------------------------------------------------------------
@overload # 2x None
def __new__(cls, start: None, stop: None, step: None = ..., /) -> slice: ...
@overload # 1x None
def __new__(cls, start: _T1, stop: None, step: None = ..., /) -> slice[_T1 | None]: ...
@overload # 1x None
def __new__(cls, start: None, stop: _T2, step: None = ..., /) -> slice[_T2 | None]: ...
@overload # 0x None
def __new__(cls, start: _T1, stop: _T2, step: None = ..., /) -> slice[_T1, _T2]: ...
# tenary overloads -----------------------------------------------------------------
# ternary overloads ----------------------------------------------------------------
@overload # 2x None
def __new__(cls, start: None, stop: None, step: _T3, /) -> slice[Any, Any, _T3]: ...
@overload # 1x None
Expand Down
Loading
0