next up previous contents
Next: The Formatting Operator Up: String Literals Previous: Triple-quoted strings

String Literal Juxtaposition

One final twist: you can juxtapose multiple string literals. Two or more adjacent string literals (but not arbitrary expressions!) separated only by whitespace will be concatenated (without intervening whitespace) into a single string object at compile time. This makes it possible to continue a long string on the next line without sacrificing indentation or performance, unlike the use of the string concatenation operator + or the continuation of the literal itself on the next line (since leading whitespace is significant inside all types of string literals). Note that this feature, like all string features except triple-quoted strings, is borrowed from Standard C.



guido@cwi.nl