On 14/03/18 12:18, Facundo Batista wrote:
What would you think about formally descouraging the following idiom?

     long_string = (
         "some part of the string "
         "with more words, actually is the same "
         "string that the compiler puts together")

-1. I use it a fair bit, and prefer it to explicit concatenation. But then I come from C, so I'm used to it.

> Note that there's no penalty in adding the '+' between the strings,
> those are resolved at compilation time.

Is that assertion true? In all Python compilers? I would expect the constant string implicit concatenation to produce single constants efficiently, but explicit concatenation doing the constant folding is a much less sure bet.

--
Rhodri James *-* Kynesim Ltd
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to