mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-08 21:14:48 +08:00
add overload to tuple.__new__ to better express an empty tuple (#7454)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
This commit is contained in:
@@ -910,7 +910,12 @@ class slice:
|
||||
def indices(self, __len: SupportsIndex) -> tuple[int, int, int]: ...
|
||||
|
||||
class tuple(Sequence[_T_co], Generic[_T_co]):
|
||||
def __new__(cls: type[Self], __iterable: Iterable[_T_co] = ...) -> Self: ...
|
||||
# overloads are ordered this way to pass `isinstance` checks
|
||||
# see: https://github.com/python/typeshed/pull/7454#issuecomment-1061490888
|
||||
@overload
|
||||
def __new__(cls: type[Self], __iterable: Iterable[_T_co]) -> Self: ...
|
||||
@overload
|
||||
def __new__(cls) -> tuple[()]: ...
|
||||
def __len__(self) -> int: ...
|
||||
def __contains__(self, __x: object) -> bool: ...
|
||||
@overload
|
||||
|
||||
Reference in New Issue
Block a user