News for hackers. Stuff that matters.
Re:5% of 666 Python repos had comma typo bugs (inc V8, Tenso... by nojs on Friday January 07, 2022 @03:49PM (#29844609)
> The most common way to split a string in lines is using this concatenation formula.

Is it really? I tend to avoid it in favour of ””” or ‘\n’.join(<list of lines>), because it looks like a mistake.

Triple quotes are kind of annoying if the string is indented, but you can just not indent the string to avoid the whitespace.

Re:5% of 666 Python repos had comma typo bugs (inc V8, Tenso... by nostoc on Saturday January 08, 2022 @01:24AM (#29849141)
Both of your solutions are great but don't fully cover the use case. They are useful for multiline strings, but implicit concatenation is also often used to break long strings that may not have newlines.
Re:5% of 666 Python repos had comma typo bugs (inc V8, Tenso... by boublepop on Saturday January 08, 2022 @02:42AM (#29849563)
In y opinion that would be better served with ‘’.join( ‘hello’, ‘world’)

No footgun potential, and as others have mentioned the “good usage” would often be bad simply because it ends up looking like a mistake even if it’s intentional.

Re:5% of 666 Python repos had comma typo bugs (inc V8, Tenso... by housecarpenter on Friday January 07, 2022 @06:29PM (#29846433)
I use it, personally. The other two options I find too aesthetically displeasing: not indenting the string looks bad when it's within an indented block of code, and using join and putting the strings in a list is just too much boilerplate. I will use """ if I don't care about the extra space put at the start of each line by the indentation.
Re:5% of 666 Python repos had comma typo bugs (inc V8, Tenso... by Spivak on Friday January 07, 2022 @06:45PM (#29846620)