3 ms·
> But don't mischaracterise python's standard library. My main point is Ruby's stdlib is richer than Python's. (And that's not either better or worse. Some pe
by tanin 7y ago
> But don't mischaracterise python's standard library.
My main point is Ruby's stdlib is richer than Python's.
(And that's not either better or worse. Some people prefer lighter stdlib, and that's fine.)
> If you don't want to write 19 characters to find the first item in a list, pick another language.
Yes, if Python supported `.first`, I wouldn't want to write the longer version of it.
Since the article focuses on brevity, I did propose another language here, which was Ruby. It would serve better at how succinct a dynamic-typed language can be because of its richer stdlib, especially when we compare a dynamic-typed lang with Scala, which has an extremely rich stdlib. Using Ruby would be a fairer comparison.
I gave one small example (`.first` vs `a[0] if a else None`) to illustrate my claim. Two more examples (from https://ruby-doc.org/core-2.4.1/Array.html https://ruby-doc.org/core-2.4.1/Array.html) are `.rotate` and `.transpose`. I'm sure there are more examples around Hash and other data structures.
Python don't have these methods, and we have to make them ourselves. To make code even longer, we need to maintain and write unit tests on them.