3 ms·
I have also found Python’s stdlib to be laughably bad. Just compare the data structures available to Scala. I write Python everyday and honestly, it’s a chore.
by mruts 7y ago
I have also found Python’s stdlib to be laughably bad. Just compare the data structures available to Scala. I write Python everyday and honestly, it’s a chore. The language is primitive and inexpressive.
The sad part is that it totally didn’t have to be this way. But instead of evolving, Python is just stuck in the past.
- snazz 7y agoCould you point to some specific examples?
- mruts 7y agoPython has Lists (arrays), Dict, and Sets. That's pretty much it. There's no linked lists. There's no sorted maps, no sorted sets, no maps that preserve insertion order, no queues, no priority queues, no bitsets. And there's no immutable collection in Python besides strings. Meanwhile, Scala has all of that and more: https://docs.scala-lang.org/overviews/collections/overview.html https://docs.scala-lang.org/overviews/collections/overview.h... Moreover, scala has synchronized collections that can work over multiple threads. I guess all collections work that way in Python, but that's because Python doesn't even support true thread parallelism in the first place! Also, if we're talking about the number of methods on the collections, Scala has way way more. map/foreach/filter/foldl/foldr/option/drop/take/first/last etc etc.
- zodiac 7y ago> And there's no immutable collection in Python besides strings frozensets, tuples?
- tanin 7y agoHere was one example I encountered a while back: https://stackoverflow.com/questions/952914/how-to-make-a-flat-list-out-of-list-of-lists https://stackoverflow.com/questions/952914/how-to-make-a-fla... In Python, it's `import itertools` and `list(itertools.chain.from_iterable(list2d))` or `[item for sublist in list2d for item in sublist]`. In Scala, it is `list2d.flatten`. In fact, Python is against making a richer stdlib in general. "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... And, intuitively, when you don't want to provide a helper function, the user code gets longer. Not that this is better or worse. It's just that, specifically, on the brevity aspect, Python code would generally becomes longer. Because, as you see in the quote, "People seem to enjoy writing their own versions of flatten".