Python's longstring facility is very useful, but unhappily breaks indentation. I find myself writing code like
msg = ('From: %s\r\n' + 'To: %s\r\n' + 'Subject: Host failure report for %s\r\n' + 'Date: %s\r\n' + '\r\n' + '%s\r\n') % (fr, ', '.join(to), host, time.ctime(), err) mail.sendmail(fr, to, msg) instead of msg = ('''From: %s To: %s Subject: Host failure report for %s Date: %s %s ''') % (fr, ', '.join(to), host, time.ctime(), err) mail.sendmail(fr, to, msg) while wishing for a msg = i'''From: %s To: %s\r\n' Subject: Host failure report for %s Date: %s %s ''' % (fr, ', '.join(to), host, time.ctime(), err) mail.sendmail(fr, to, msg.replace('\n', '\r\n')) isn't it so much prettier? (((an indented longstring, i''' ... ''' behaves like a regular longstring except that indentation on the lines following the beginning of the longstring is stripped up to the first character position of the longstring on the first line. non-blanks before that character position are a syntax error))) Avi _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com