News for hackers. Stuff that matters.
Re:5% of 666 Python repos had comma typo bugs (inc V8, Tenso... by atleta on Friday January 07, 2022 @01:23PM (#29842702)
Not sure if it's irony or not. After all, this is not really accidental string concatenation but an easy to make type error which can go undetected due to the dynamic typing (and the lack of thorough type annotation in most code).

The string concatenation in itself should not be a problem as it's really just string constants. (But again, it might be irony exactly because of this :) )

Re:5% of 666 Python repos had comma typo bugs (inc V8, Tenso... by oaiey on Friday January 07, 2022 @01:37PM (#29842905)
Unfortunately no irony.

I come from a programming platform (C#) where productivity is a key element of language design. I highly doubt that Anders Heijlsberg would have accepted such a error prone concept like a literal free implicit operator on a key type like strings.

Re:5% of 666 Python repos had comma typo bugs (inc V8, Tenso... by atleta on Friday January 07, 2022 @02:33PM (#29843624)
Well, I guess it's true for most language that productivity is intended to be a key element of design. (For python, definitely. But I also remember James Gosling saying this about Java.) This implicit concatenation seems to come (inherited?) from C.

I kind of remembered that some languages do support it for braking strings into multiple lines conveniently. I'm a bit surprised that it works even on line (I've never used it, because why would have I), but you'll likely to make the mistake on multiline statements anyway. I've also checked and it doesn't work in java (which I kind of remembered, though I mostly do python these days).

Re:5% of 666 Python repos had comma typo bugs (inc V8, Tenso... by amelius on Friday January 07, 2022 @04:09PM (#29844862)
> for braking strings into multiple lines conveniently

What is inconvenient about just adding a + at the end or beginning of the line?

Re:5% of 666 Python repos had comma typo bugs (inc V8, Tenso... by ErikCorry on Friday January 07, 2022 @01:33PM (#29842859)
In most languages an array with 3 elements has the same type as an array with 2 elements so the type system isn't going to warn you about the difference between

("foo" "bar", "baz")

and

("foo", "bar", "baz")

Re:5% of 666 Python repos had comma typo bugs (inc V8, Tenso... by skitter on Friday January 07, 2022 @02:20PM (#29843496)
They still tend to differentiate between 2- and 3 element tuples (but I agree that the implicit concatenation is problematic).
Re:5% of 666 Python repos had comma typo bugs (inc V8, Tenso... by atleta on Friday January 07, 2022 @02:20PM (#29843502)
Fair enough. I was only thinking about the str vs tuple case. So when you have 2 elements in the parenthesis.