<div dir="ltr"><div style class="markdown-here-wrapper" id="markdown-here-wrapper-862322"><p style="margin:1.2em 0px!important">2013/7/1 Guido van Rossum <a href="mailto:guido@python.org">guido@python.org</a></p>
<blockquote style="margin:1.2em 0px;border-left:4px solid rgb(221,221,221);padding:0px 1em;color:rgb(119,119,119);quotes:none">
<p style="margin:1.2em 0px!important">That‘s a compelling argument. Let’s do it. (Assuming the definition of<br>exactly how to indent or dedent is not up for discussion — if there<br>are good reasons to disagree with textwrap now's the time to bring it<br>
up.)</p>
</blockquote>
<p style="margin:1.2em 0px!important">I don’t know if it’s a good reason, but I’m of the opinion that the required backslash at the beginning of to-be-dedented string is strange:</p>
<p style="margin:1.2em 0px!important">We try to eliminate escaped newlines elsewhere (e.g. bracing import statements, conditions and tuple values is preferred to escaping newlines)</p>
<p style="margin:1.2em 0px!important">I think dedent (or however it’s going to be called) should remove common whitespace and, if the first line is completely empty, that first line as well.</p>
<p style="margin:1.2em 0px!important">Also for your consideration would be scala’s way:</p>
<pre style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;font-size:1em;line-height:1.2em;margin:1.2em 0px"><code style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;margin:0px 0.15em;padding:0px 0.3em;white-space:pre-wrap;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-radius:3px 3px 3px 3px;display:inline;white-space:pre;overflow:auto;border-radius:3px 3px 3px 3px;border:1px solid rgb(204,204,204);padding:0.5em 0.7em;display:block;padding:0.5em;color:rgb(51,51,51);background:none repeat scroll 0% 0% rgb(248,248,255)" class="language-python"><span style="color:rgb(221,17,68)" class="string">"""|spam
   |eggs"""</span>.stripMargin() == <span style="color:rgb(221,17,68)" class="string">"spam\neggs"</span>

<span style="color:rgb(221,17,68)" class="string">"""#spam
   #eggs"""</span>.stripMargin(<span style="color:rgb(221,17,68)" class="string">'#'</span>) == <span style="color:rgb(221,17,68)" class="string">"spam\neggs"</span></code></pre>
<p style="margin:1.2em 0px!important">i.e. removal of all leading whitespace up to and including a margin character/prefix. It could be a kwarg to “dedent”…</p>
</div></div>