Make func in builtin map optional in Python 2 (#1751)

* Make `func` in builtin `map` optional in Python 2

* Add `map` overloads with `None` `func` in Python 2
This commit is contained in:
Semyon Proshev
2017-11-22 18:57:07 +03:00
committed by Jelle Zijlstra
parent 622e744f3e
commit b0d9752a1c

View File

@@ -732,6 +732,12 @@ def map(func: Callable[[_T1, _T2], _S],
iter1: Iterable[_T1],
iter2: Iterable[_T2]) -> List[_S]: ... # TODO more than two iterables
@overload
def map(func: None, iter1: Iterable[_T1]) -> List[_T1]: ...
@overload
def map(func: None,
iter1: Iterable[_T1],
iter2: Iterable[_T2]) -> List[Tuple[_T1, _T2]]: ... # TODO more than two iterables
@overload
def max(arg1: _T, arg2: _T, *args: _T, key: Callable[[_T], Any] = ...) -> _T: ...
@overload
def max(iterable: Iterable[_T], key: Callable[[_T], Any] = ...) -> _T: ...