June 2000
Intermediate to advanced
556 pages
8h 45m
English
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 ...
Read now
Unlock full access