Re:Examples of Incorrect Abstractions in Other Languages
by lmm on Wednesday May 20, 2020 @05:52AM
(#23245037)
> "".join(["a", "b"]) is a lot more intuitive than sum(["a", "b"], start="")
No it isn't. The join method being on the separator string is a Pythonism that looks crazy coming from any other language.
Re:Examples of Incorrect Abstractions in Other Languages
by theelous3 on Wednesday May 20, 2020 @07:34AM
(#23245646)
The point they are making is that
join(xs, "")
xs.join("")
or whatever else you want to come up with is more readable than building more string stuff in to sum, not that having join be a str method is the best way.
At least, readability suffers.
"".join(["a", "b"]) is a lot more intuitive than sum(["a", "b"], start="")
edit: A beautiful abstraction is the one that feels as good when it's read as when it's written.