4 ms·
The Scala result confirms my bias :P I love Scala because it strikes a great balance between being succinct and offering type safety. I wish you would use Ruby
by tanin 7y ago
The Scala result confirms my bias :P I love Scala because it strikes a great balance between being succinct and offering type safety.
I wish you would use Ruby instead of Python. Python is strangely inconsistent. For example, Python doesn't really offer a rich standard library; people have to resort to ugly solutions for a simple problem (here's an example: https://stackoverflow.com/questions/363944/python-idiom-to-return-first-item-or-none https://stackoverflow.com/questions/363944/python-idiom-to-r...)
Ruby would be better at an example of how a dynamic language can be more succinct.
- trishume 7y agoPreaching to the choir, I personally use Ruby over Python :) But I had to source from friends in the class, and my group used Rust because I'm all about that performance and correctness nowadays.
- nhumrich 7y ago"python doesnt offer a rich standard library" Python is usually considered one of the richest standard libraries out there. Yes, the is no standard way to get this one edgecase, but every language has warts and things like that. It sounds like you are just looking for an excuse to hate on Python.
- tanin 7y ago> but every language has warts and things like that Sure, but we are talking about the brevity of a language. The richness of the standard library directly impacts brevity. So, Ruby would have been a better representative (for brevity) of a high-level dynamic-typed language. > the is no standard way to get this one edgecase I don't think `.first` is an edge case. It is used fairly often. One example that I can think of right now is when you want to fetch the first row from MySQL. MySQL returns an array, and you would need `.first` to get the first row or null. > It sounds like you are just looking for an excuse to hate on Python Not at all. While I don't prefer Python, I recognize there's a downside to a richer standard library. The language becomes more complex; harder to learn. Richest is relative. If we consider Python against every other programming language, then, yes, it's ONE of the richests. If we consider Python vs. Ruby vs. Scala, I doubt Python would be considered as richer or richest. For example, 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. There are many examples where Ruby version would result in shorter code like `array.delete_if` and etc. Python probably doesn't offer many of these methods.
- zapzupnz 7y ago> It sounds like you are just looking for an excuse to hate on Python. That's a big claim to make based on a couple of assertions that are neither about the quality of Python as a language nor the quality of its standard library, merely observations and comparisons. Are you sure it's not you who is upset to see Python 'attacked' (for lack of a better term) in any way?
- nindalf 7y agoYour linked stackoverflow question - how do you return the first item of the list or None. Proposed solution - `a[0] if a else None` Your reaction - Python doesn't offer a rich standard library. I disagree, and I suspect most programmers would too. We'd much rather have ergonomic libraries to make http requests, parse command line arguments, datetime, itertools, data structures like heaps, filesystem access, data archiving, data serialization and deserialization and a million other nice-to-haves. It's actually at the point where I've heard criticism of Python's stdlib doing too many things, rather than too few. If you don't want to write 19 characters to find the first item in a list, pick another language. But don't mischaracterise python's standard library.
- mruts 7y agoI 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.