[Python-ideas] Implicit String Concatenation

Jim Jewett jimjjewett at gmail.com
Thu Apr 12 18:11:01 CEST 2007


On 4/12/07, Neil Toronto <ntoronto at cs.byu.edu> wrote:
> Jan Kanis wrote:
> > On Wed, 11 Apr 2007 23:54:11 +0200, Terry Reedy <tjreedy at udel.edu> wrote:

> > Indeed, I don't really like this syntax. I do like if there'd be a way to
> > spell 'multiline string with indentation chopped off'.

Most of the time, the extra indents are OK.  And if they aren't, it is
usually OK to start the string with a blank line.  (So everything is
aligned to left, at least.)

Would textwrap.dedent do what you wanted (if it were added to __all__)?
Should it have a mode to skip the first line?
Should there be a TextWrapper expose it somehow?  (My thought would be
to optionally call it from within _munge_whitespace.)

>     a = """Some text.
>         Some intentionally indented text."""

> How often do people rely on those tabs or spaces being preserved?

For doctests, mainly, so a consistent change would be OK ...  but
triple quoted strings are supposed to be almost exactly WYSIWYG.

-jJ



More information about the Python-ideas mailing list