Correct return type of sum() builtin (#1582)

`sum([])` always returns the integer 0.
This commit is contained in:
Travis Parker
2017-10-04 21:42:35 -07:00
committed by Jelle Zijlstra
parent 000041761e
commit 355f30cc70
2 changed files with 8 additions and 2 deletions

View File

@@ -789,7 +789,10 @@ def sorted(iterable: Iterable[_T], *,
cmp: Callable[[_T, _T], int] = ...,
key: Callable[[_T], Any] = ...,
reverse: bool = ...) -> List[_T]: ...
def sum(iterable: Iterable[_T], start: _T = ...) -> _T: ...
@overload
def sum(iterable: Iterable[_T]) -> Union[_T, int]: ...
@overload
def sum(iterable: Iterable[_T], start: _S) -> Union[_T, _S]: ...
def unichr(i: int) -> unicode: ...
def vars(object: Any = ...) -> Dict[str, Any]: ...
@overload