3 ms·
why is it broken?
by ivanivanovich 5y ago
why is it broken?
- revskill 5y agoIn common sense, u just need to put a function into map, right ? x.map(fn) In python, mapped takes some arguments that makes me confused in order and types of arguments. Secondly, it broke my thinking process.
- whymauri 5y agoHaving a different interface doesn't mean its broken...
- kzrdude 5y agoInline code completion/IDE integration can have it show the parameter names or docstring inline in the editor. That helps me with map, specifically. :) With that configured, a window pops up in Vim and says we have: map(func: Callable[[_T1], _S], iter1: Iterable[_T1], /) -> Iterator[_S] —————————————————————————————————————————————————————————————————————————————— map(func, *iterables) --> map object Make an iterator that computes the function using arguments from each of the iterables. Stops when the shortest iterable is exhausted. —————————————————————————————————————————————————————————————————————————————— There are things to criticize here. Note that the type hinting (this is Python 3.8 btw) doesn't agree with the full generality of the stated function interface (the multiple iterables part).