On Mon, 27 Oct 2008 12:11:34 +1300, Lawrence D'Oliveiro wrote: > In message <[EMAIL PROTECTED]>, Steven D'Aprano > wrote: > >> I disagree. Triple-quoted strings are exactly the same as other >> strings: they capture *exactly* what you put in them ... > > But that conflicts with the use of whitespace for indentation rules.
No it doesn't. Indentation is a token in Python source code. Strings are a data type. Syntax rules don't apply to strings because strings are data, not syntax. You wouldn't expect the following string literal to raise a syntax error: "if Time = Money then ..." Nor does the string "C++", and the string "1/0" doesn't raise ZeroDivisionError. Strings are data, not syntax. Except for the syntactic sugar of escape sequences, the contents of strings have no syntax. (I say content to distinguish it from the delimiters themselves.) Why should whitespace in string literals be treated as syntactic tokens when no other characters are? [...] > In short, if whitespace is significant outside a string, then it > shouldn't be significant inside. And vice versa. That's an arbitrary rule that makes no sense at all. It's not just arbitrary, it's *stupid*. Why on earth should the string literal s = """ text aligned to the right """ raise an IndentationError? Or should it be a SyntaxError? -- Steven -- http://mail.python.org/mailman/listinfo/python-list