[Python-ideas] Multi-line strings that respect indentation
Carl M. Johnson
cmjohnson.mailinglist at gmail.com
Sat Nov 6 00:48:49 CET 2010
More information about the Python-ideas mailing list
Sat Nov 6 00:48:49 CET 2010
- Previous message: [Python-ideas] Multi-line strings that respect indentation
- Next message: [Python-ideas] Multi-line strings that respect indentation
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Fri, Nov 5, 2010 at 10:37 AM, Terry Reedy <tjreedy at udel.edu> 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: >> >> 1. 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 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
- Previous message: [Python-ideas] Multi-line strings that respect indentation
- Next message: [Python-ideas] Multi-line strings that respect indentation
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-ideas mailing list