[Python-ideas] Implicit String Concatenation

Ron Adam rrr at ronadam.com
Sat Apr 14 04:54:44 CEST 2007

Greg Ewing 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.

Reminds me of ...


Note that the optional implementation of this has already been put in 
Python 2.5 just as it said it would be.

How about using indenting along with implicit string endings?

    def foo(...):

        message = ```
            This is a multi-
            line string +
            implicit right stripping.

        print message

Just kidding of course.  The back-quotes will never be approved.  ;-)

I don't know what would be the best solution because just about anything I 
can think of has some sort of side effects in some situations.  Maybe if 
line based editors are ever completely replaced with folding graphic 
editors it will no longer be a problem because all our multi-line strings 
can have nice borders around them.


More information about the Python-ideas mailing list