On Fri, Nov 5, 2010 at 10:37 AM, Terry Reedy firstname.lastname@example.org wrote:
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)
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
Can the parser be changed to do automagic joining on that the same way that it auto joins ("a"
"b")? I can't imagine any scenario where anyone would rely on starting the line after a docstring with a string literal, since the only plausible run time effect it might have would be to intern some strings for later. Even "string".method() wouldn't have any effect without something like x = in front of.
-- Carl Johnson