On Sat, Aug 25, 2012 at 1:39 PM, Alan Gauld <alan.ga...@btinternet.com> wrote:
>
> two adjacent strings without a comma get combined into a single string.
> Its a feature... mainly a remnant from the C foundations I suspect.

As a feature it can come in handy with long strings in expressions.

Just for reference about the "C foundations", here's a similar example in C.

    #include <stdio.h>

    int main() {

        int i, x_len;

        char *x[] = {
          "string1",
          "string2",
          "string3"  /* no comma */
          "string4"
        };

        x_len = sizeof(x) / sizeof(x[0]);

        for (i = 0; i < x_len; i++) {
            printf("%s\n", x[i]);
        }

        return 0;
    }

Output:

    string1
    string2
    string3string4
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to