re: What simple things annoy you about your favourite programming languages? VIEW POST

FULL DISCUSSION
 

In Python:

"Hello" "World" == "HelloWorld"

This leads to bugs when you're writing an array of strings. This happens to me especially often when writing Django settings.py files

INSTALLED_APPS = [
  "foo",
  "bar"
  "baz"
]

This sets ÌNSTALLED_APPSto["foo", "barbaz"]`. I wish this would throw a SyntaxError.

 

C and C++ both do such string concatenation as well, though I've always considered it a feature. Put in this form it definitely will lead to unintended defects.

I wonder why it's there, given PYthon has string concatenation with a simple +.

 

Because

"hello" +
"world"

is a syntax error, since the + doesn't make python join the lines. You'd have to do

("hello" +
"world)
code of conduct - report abuse