3 ms·
> Why not just go one step further and just do the thing instead of nag the user to do the thing? At least, readability suffers. "".join(["a", "b"]) is a lot
by fractalb 6y ago
> Why not just go one step further and just do the thing instead of nag the user to do the thing?
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.
- deleted 6y ago[deleted]
- lmm 6y ago> "".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.
- theelous3 6y agoThe 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.