On 11/5/2010 10:45 AM, Nick Coghlan wrote:
I do use the textwrap.dedent workaround myself, but I think it is sufficiently flawed for a proper fix to be worth considering:
- It doesn't work for docstrings (as Tal pointed out)
This does:
def f(x): "Am I a docstring\n"\ "even though I start in pieces?\n"\ "Oh, x is a dummy param\n" pass print(f.__doc__)
# prints 3 lines, but not without '' escape at line ends
- It postpones until runtime an operation that could fairly easily be
carried out at compile time instead
Above is. Not that I like the extra fluff needed to make it work. It makes a 'd' for dedent literal prefix look inviting.