writing code over several lines

Gary Herron gherron at islandtraining.com
Fri Oct 17 11:13:58 EDT 2003


> LIST = [[100, 101, 102], [200, 201, 202], [300, 301, 302],
>         [400, 401, 402], [500, 501, 502], [600, 601, 602],
>         [700, 701, 702], [800, 801, 802], [900, 901, 902]]

There are several ways to do it.

Anything within [...], (...) or {...} can span lines and needs follow
NO indent rules.  So your example works just as it is.

Another way is to end any line with a backslash.  Then the following
line is logically appended to the current line, and again its indent
is irrelevant.  I rarely use this because I think it's ugly and because
I can put almost anything between parentheses.

Gary Herron







More information about the Python-list mailing list