4 ms·
I know. It's strange to say that. But Scala's library is very very rich. Another example is that Scala offers a lot of ways to process a list like foldLeft, fo
by tanin 7y ago
I know. It's strange to say that. But Scala's library is very very rich.
Another example is that Scala offers a lot of ways to process a list like foldLeft, foldRight, unzip, headOption, lastOption, flatMap, groupBy, and many methods around Map, Set, and etc. Python probably doesn't offer many of these methods.
Of course, this comes with the cost of higher learning curve.
- xenator 7y agoList of standard methods of this kind https://docs.python.org/3/library/itertools.html https://docs.python.org/3/library/itertools.html
- tanin 7y agoYes, itertools is great. But its stblib is still much lighter than Scala's and Ruby's. Actually, that seems to be the direction/principle of Python, where it is less inclined to add a helper function. "It has been discussed ad nauseam on comp.lang.python. People seem to enjoy writing their own versions of flatten more than finding legitimate use cases that don't already have trivial solutions." from https://softwareengineering.stackexchange.com/questions/254279/why-doesnt-python-have-a-flatten-function-for-lists https://softwareengineering.stackexchange.com/questions/2542... Not that this is better or worse. It's just that, on the brevity aspect, Python code is gonna be longer.