
On 17 Oct 2019, at 22:44, Steven D'Aprano <steve@pearwood.info> wrote:
On Thu, Oct 17, 2019 at 01:42:54PM +0200, Anders Hovmöller wrote:
The multiply a list/string thing is a big mistake imo. You almost never use it so the cost of not having it is almost nothing while the cost of having type errors propagate beyond the point where they happened is big.
I use string repetition and concatenation frequently. For example, for indenting a string I much prefer this:
string = " "*n + string
over something like
string = ''.join([''.join(' ' for __ in range(n)), string])
Yes that's terrible. But `" ".fill(n) + string"` would be just as good but without being a source of bugs that pollutes downstream execution.
List repetition, not so often, but I do use list concatenation and even more so tuple concatenation.
Which are fine because the types at least have to match. It would have been better with a dedicated concat operator I think but just a little bit better.