6.1. Dealing with Long Lines
As you know, Python uses indentation to control the grouping of statements for execution. Depending on personal taste or editing environment restrictions, this indentation can cause problems. The program below is not syntactically correct because the assignment to the variable with the very long name has wrapped around to two lines.
CD-ROM reference=6001.txt if x: if y: if z: if a: if b: while x: for n in foo: SomeVeryLongVariableNameGoshWouldAnyoneReallyHave OneOfThese = SomeVeryLongVariableNameGoshWouldAnyoneReallyHave OneOfThese + 1
The first thing to say about a long line is that it occurs very infrequently in practice! If it does occur, there are a number of ways to deal with it. First, terminating a line with ...
Get XML Processing with Python now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.