> On 17 Oct 2019, at 22:44, Steven D'Aprano <st...@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. 
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/XAVI2C67VT6GQLIGIIERFGLKEEW5DTGK/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to