Hi! On Wed, Mar 14, 2018 at 09:18:30AM -0300, Facundo Batista <facundobati...@gmail.com> wrote: > Hello! > > 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") > > We should write the following, instead: > > long_string = ( > "some part of the string " + > "with more words, actually is the same " + > "string that the compiler puts together") > > I know that "no change to Python itself" is needed, but having a > formal discouragement of the idiom will help in avoiding people to > fall in mistakes like: > > fruits = { > "apple", > "orange" > "banana", > "melon", > }
I am all for that, with both hands! +1000000, dammit! Once I stumbled over a bug caused by this in legacy code in production. Fixing it was quite painful! The problem with the idiom is it's too easy to make the mistake and rather hard to find. > (and even making the static analysers, like pyflakes or pylint, to > show that as a warning) > > Note that there's no penalty in adding the '+' between the strings, > those are resolved at compilation time. > > Thanks!! > > -- > . Facundo > > Blog: http://www.taniquetil.com.ar/plog/ > PyAr: http://www.python.org/ar/ > Twitter: @facundobatista Oleg. -- Oleg Broytman http://phdru.name/ p...@phdru.name Programmers don't die, they just GOSUB without RETURN. _______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/