Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Re: Problem with the "for" loop syntax

Reply
Thread Tools

Re: Problem with the "for" loop syntax

 
 
Cameron Simpson
Guest
Posts: n/a
 
      06-20-2013
On 20Jun2013 11:09, Chris Angelico <(E-Mail Removed)> wrote:
| On Thu, Jun 20, 2013 at 11:02 AM, Arturo B <(E-Mail Removed)> wrote:
| > Fixed, the problem was in
| > HANGMANPICS
| >
| > I didn't open the brackets.
| > Thank you guys
|
| General debugging tip: Syntax errors are sometimes discovered quite
| some way below the actual cause. The easiest way to figure out what's
| the real cause is to start cutting away unnecessary code until all
| that's left is the tiniest part that still has the error. This is also
| very helpful as a prerequisite to posting on a list like this, so even
| if you can't find the problem yourself by this method (you often will,
| though), it's well worth doing.

Also, opening-and-not-closing a set of brackets is almost the only
way in Python to make this kind of error (syntax at one line, actual
mistake far before).

See if your editor has a show-the-matching-bracket mode.

I use vi/vim and it both shows the matching bracket when the cursor
is on one and also have a keystroke to bounce the curser between
this bracket and the matching one.

If you suspect you failed to close a bracket, one approach is to
go _below_ the syntax error (or right on it) and type a closing
bracket. Then see where the editor thinks the opening one is.

If you have a syntax highlighting editor (highlights keywords,
colours quoted text differently, etc) it can also be useful for
finding errors; the text will be the wrong colour at some point.

Just a few suggestions to aid finding this kind of thing without
outside help.

Cheers,
--
Cameron Simpson <(E-Mail Removed)>

Are you experiencing more Windows95 crashes than the norm? How on earth
would you _know_? - John Brook <(E-Mail Removed)>
reporting about a new virus
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with the Java Access Bridge and the screenreader JAWS Markus Lemcke Java 3 05-07-2013 05:27 PM
Software must support the user's settings for font size but how itworks with swing? Markus Lemcke Java 6 05-01-2013 05:16 PM
How to capture the “same” RGB images for the same scene using EDSDK? azuring@gmail.com Digital Photography 0 04-28-2013 12:08 PM
Help with printing a bit pattern with printf and %x matt.jaffe@gmail.com C Programming 9 04-19-2013 12:14 PM
SimpleHTTPRequestHandler used with HTTP/1.1 hangs after the secondresource on a page. Piotr Dobrogost Python 3 04-13-2013 05:21 PM



Advertisments