[Python-ideas] Implicit String Concatenation

Jim Jewett jimjjewett at gmail.com
Mon Apr 16 19:01:50 CEST 2007


On 4/13/07, Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:
> Josiah Carlson wrote:

> >>Does anyone have a use case where they *need*
> >>the indentation to be preserved?

> > Not personally.  I think that telling people to
>  > use textwrap.dedent() is sufficient.

> But it seems crazy to make people do this all
> the time, when there's no reason not to do
> it automatically in the first place.

The textwrap methods (including a proposed dedent) might make useful
string methods.  Short of that


(1)  Where does this preservation actually hurt?

    def f(self, arg1):
        """My DocString ...

        And I continue here -- which really is what I want.
        """

I use docstrings online -- and I typically do want them indented like the code.

(2)  Should literals (or at least strings, or at least docstrings) be
decoratable?  Anywhere but a docstring, you could just call the
function, but ... I suppose it serves the same meta-value is the
proposed i(nternational) or t(emplate) strings.

    def f(...):
        ....
        @dedent
        """ ...
        ...
        """

-jJ



More information about the Python-ideas mailing list