[Python-ideas] Implicit String Concatenation

Tal Einat taleinat at gmail.com
Sat Apr 14 18:34:32 CEST 2007

On 4/12/07, Adam Atlas <adam at atlas.st> wrote:
> Meanwhile, on a similar subject, I have a... strange idea. I'm not
> sure how easy/hard it would be to parse or how necessary it is, but
> it's just a thought.


So anyway,
> what I'm proposing is the following:
> x = 'foo
>      'bar
>      'baz'
> Any
> thoughts?

-1 on such new syntax.

What i usually do is:
message = ("yada yada\n"
           "more yada yada\n"
           "even more yada.")

This works a lot like what you suggest, but with Python's current syntax. If
implicit string concatenation were removed, I'd just add a plus sign at the
end of each line.

This is also a possibility:
message = "\n".join([
    "yada yada",
    "more yada yada",
    "even more yada."])

The latter would work even better with the removal of implicit string
concatenation, since forgetting a comma would cause a syntax error instead
of skipping a newline.

- Tal
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20070414/588d8896/attachment.html>

More information about the Python-ideas mailing list