Intermediate Python user needed help

Steven D'Aprano steve+comp.lang.python at pearwood.info
Sun Aug 5 16:24:45 EDT 2012


On Sun, 05 Aug 2012 12:51:31 -0700, John Mordecai Dildy wrote:

> Ive tried to delete the spaces in 75 and 76 to see if it made a change
> but it has not made a difference to it.

What made you think that the problem could be fixed by deleting *spaces*?

In general, making random changes to code in the hope that syntax errors 
will just go away is not the right way to fix broken code. Even if you 
succeed, since you don't know what you did to fix it, how do you know 
that your next change won't break it again?

Almost always, when you have a mysterious syntax error on a line that 
appears to be perfectly fine, the reason is a missing bracket of some 
sort on a previous line. (For Americans, I mean parentheses, brackets or 
braces; for Britons and Australians, round square or curly brackets; for 
everyone else, whatever you call them.)


-- 
Steven



More information about the Python-list mailing list