On 4/16/07, <b class="gmail_sendername">Jim Jewett</b> <<a href="mailto:jimjjewett@gmail.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">jimjjewett@gmail.com</a>> wrote:<div><span class="q">
<span class="gmail_quote"></span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
On 4/13/07, Greg Ewing <<a href="mailto:greg.ewing@canterbury.ac.nz" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">greg.ewing@canterbury.ac.nz</a>> wrote:<br>> Josiah Carlson wrote:<br><br>
> >>Does anyone have a use case where they *need*<br>> >>the indentation to be preserved?
<br><br>> > Not personally.  I think that telling people to<br>>  > use textwrap.dedent() is sufficient.<br><br>> But it seems crazy to make people do this all<br>> the time, when there's no reason not to do
<br>> it automatically in the first place.<br><br>The textwrap methods (including a proposed dedent) might make useful<br>string methods.  Short of that<br><br><br>(1)  Where does this preservation actually hurt?<br><br>

    def f(self, arg1):<br>        """My DocString ...<br><br>        And I continue here -- which really is what I want.<br>        """<br><br>I use docstrings online -- and I typically do want them indented like the code.
<br><br>(2)  Should literals (or at least strings, or at least docstrings) be<br>decoratable?  Anywhere but a docstring, you could just call the<br>function, but ... I suppose it serves the same meta-value is the<br>proposed i(nternational) or t(emplate) strings.
<br><br>    def f(...):<br>        ....<br>        @dedent<br>        """ ...<br>        ...<br>        """</blockquote></span><div><br><br>If docstrings is the problem you can always use a function decorator for it:
<br>def dedentdoc(func):<br>    func.__doc__ = dedent(func.__doc__)<br>    return func<br><br>@dedentdoc<br>def f(...):<br>    """<br>    Long and indented docstring.<br>        extra indented<br>    unindented, phew"""
<br>    pass<br><span class="sg"> <br>/Tobias<br></span></div><span class="q"><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">-jJ<br>_______________________________________________
<br>Python-ideas mailing list<br><a href="mailto:Python-ideas@python.org" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">Python-ideas@python.org</a><br><a href="http://mail.python.org/mailman/listinfo/python-ideas" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
http://mail.python.org/mailman/listinfo/python-ideas</a>
<br></blockquote></span></div><br>