Thanks for your examples. I understand tham sometimes it's a good idea not to write the HTML inside the function (although it may be nice to sometimes write it just before the function - and if it's a method, then we get the same indentation problem.)
However, as you said, sometimes it is desired to write multilined strings inside functions. You think it's ok to add white spaces to the HTML code, I personally prefer not add varying indentation to my output according to the level of indentation the code that generated it.
I just wanted to add another use case: long messages. Consider those lines from idlelib/run.py:133
msg = "IDLE's subprocess can't connect to %s:%d. This may be due "\ "to your personal firewall configuration. It is safe to "\ "allow this internal connection because no data is visible on "\ "external ports." % address tkMessageBox.showerror("IDLE Subprocess Error", msg, parent=root)
and from idlelib/PyShell.py:734:
def display_port_binding_error(self): tkMessageBox.showerror( "Port Binding Error", "IDLE can't bind TCP/IP port 8833, which is necessary to " "communicate with its Python execution server. Either " "no networking is installed on this computer or another " "process (another IDLE?) is using the port. Run IDLE with the -n " "command line switch to start without a subprocess and refer to " "Help/IDLE Help 'Running without a subprocess' for further " "details.", master=self.tkconsole.text)
I know, of course, that it could be written using textwrap.dedent, but I think that not having to load a module will encourage the use of dedent; if I have to load a module, I might say, "oh, I can live with all those marks around the text, there's no need for another module", and then, any time I want to change that message, I have a lot of editing work to do.