Modified __add__ method in tuple class (#3252)

Modified __add__ method in tuple class to allow it to accept tuples with different generic parameter types. This allows, for example:
a = (1, )
b = a + (2.4, )
This commit is contained in:
Eric Traut authored and Jelle Zijlstra committed 2019-09-30 12:42:40 +02:00
1 parent 23232c056c
commit 468d13a205
2 files changed
+6

No files matched your search

+3
View File
@@ -867,7 +867,10 @@ class tuple(Sequence[_T_co], Generic[_T_co]):
def __le__(self, x: Tuple[_T_co, ...]) -> bool: ...
def __gt__(self, x: Tuple[_T_co, ...]) -> bool: ...
def __ge__(self, x: Tuple[_T_co, ...]) -> bool: ...
@overload
def __add__(self, x: Tuple[_T_co, ...]) -> Tuple[_T_co, ...]: ...
@overload
def __add__(self, x: tuple) -> tuple: ...
def __mul__(self, n: int) -> Tuple[_T_co, ...]: ...
def __rmul__(self, n: int) -> Tuple[_T_co, ...]: ...
def count(self, x: Any) -> int: ...