+ 11

why no error?

a = ("hh""jj") print(a) Should be syntax error but it works

19th Apr 2021, 8:58 AM
Oma Falk
Oma Falk - avatar
5 Réponses
19th Apr 2021, 9:07 AM
The future is now thanks to science
The future is now thanks to science - avatar
+ 4
ok... we know it similiar from mathematical expressions: a = 3 b=2 ab = 6 so a missing operator in this field is the multiplicator In Python a missing operator between two strings is solved to default operator +. There was a pep to remove this feature but it was rejected by Guido.
19th Apr 2021, 9:21 AM
Oma Falk
Oma Falk - avatar
+ 4
I believe it was a carry over from C. It will only work with literals at compile time and not for run time strings.
19th Apr 2021, 9:24 AM
ChaoticDawg
ChaoticDawg - avatar
+ 3
https://docs.python.org/3/reference/lexical_analysis.html#string-literal-concatenation
19th Apr 2021, 9:20 AM
ChaoticDawg
ChaoticDawg - avatar
+ 3
ChaoticDawg could be the root reason👍
19th Apr 2021, 6:30 PM
Oma Falk
Oma Falk - avatar