
"It looks kind of like we're passing multiple arguments to the built-in print function. But we're not: If we pass multiple arguments to print, Python will put spaces between those values when printing: But Python wasn't doing. Our code from before didn't have commas to separate the arguments (note the missing comma between "Hello" and "world!"): How is that possible? This seems like it should have resulted in a SyntaxError!"
"A string literal is the syntax that we use in Python to create brand new strings: String literals involve using some variation of quote characters to create a string. If we write multiple string literals next to each other, Python will concatenate those strings: It's as if we put a plus sign (+) between them. But we didn't: This is called implicit string concatenation. It's a bit of an odd feature, but it can be handy sometimes."
Python treats multiple adjacent string literals as a single concatenated string. Placing string literals next to each other without commas or plus signs produces a combined literal rather than separate function arguments. Passing multiple actual arguments to print inserts spaces between values, but adjacent literals are merged before function call. The behavior is equivalent to using the plus operator between the literal pieces but occurs implicitly at compile time. The feature supports breaking long literal text across lines inside parentheses for readability. The implicit concatenation works only for string literals, not for expressions or variables. The behavior is unusual but can simplify long literal construction.
Read at Pythonmorsels
Unable to calculate read time
Collection
[
|
...
]