On 2018-03-14 08:18, Facundo Batista 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") >
Thank you for bring this up! A regex through one of my programs revealed three bugs caused by implicit concatenation in lists. Here is one of them: https://github.com/klahnakoski/ActiveData-ETL/blob/etl/activedata_etl/transforms/pulse_block_to_task=_cluster.py#L897 The missing commas were not caught until now because of the lists are long, and deal with rare cases. I did use implicit concatenation for a long SQL statement, and a few long error messages, but the byte savings is not worth the increased bug density. > self.db.execute( > "CREATE TABLE files (" + > " bucket TEXT," + > " key TEXT," + > " name TEXT," + > " last_modified REAL," + > " size INTEGER," + > " annotate TEXT, " + > " CONSTRAINT pk PRIMARY KEY (bucket, name)" + > ")" > ) is almost identical to > self.db.execute( > "CREATE TABLE files (" > " bucket TEXT," > " key TEXT," > " name TEXT," > " last_modified REAL," > " size INTEGER," > " annotate TEXT, " > " CONSTRAINT pk PRIMARY KEY (bucket, name)" > ")" > ) It looks like I am in the market for a linter that prevents implicit string concatenation! _______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/