Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #48769

Re: Problem with the "for" loop syntax

Path csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <cameron@cskk.homeip.net>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.013
X-Spam-Evidence '*H*': 0.97; '*S*': 0.00; 'syntax': 0.04; 'debugging': 0.07; 'cursor': 0.09; 'fixed,': 0.09; 'highlighting': 0.09; 'will,': 0.09; 'python': 0.11; '(syntax': 0.16; 'bracket': 0.16; 'bracket,': 0.16; 'brackets': 0.16; 'brackets.': 0.16; 'cause.': 0.16; 'from:addr:cs': 0.16; 'from:addr:zip.com.au': 0.16; 'from:name:cameron simpson': 0.16; 'message- id:@cskk.homeip.net': 0.16; 'quoted': 0.16; 'received:211.29': 0.16; 'received:211.29.132': 0.16; 'received:optusnet.com.au': 0.16; 'received:syd.optusnet.com.au': 0.16; 'simpson': 0.16; 'subject:Problem': 0.16; '(you': 0.16; 'wrote:': 0.18; 'thu,': 0.19; 'help.': 0.21; 'header:User-Agent:1': 0.23; 'error': 0.23; 'guys': 0.24; 'helpful': 0.24; 'cheers,': 0.24; '(or': 0.24; 'header:In-Reply-To:1': 0.27; 'chris': 0.29; 'am,': 0.29; 'reporting': 0.29; 'errors': 0.30; 'matching': 0.30; 'code': 0.31; 'posting': 0.31; 'keywords,': 0.31; 'figure': 0.32; 'quite': 0.32; 'text': 0.33; 'open': 0.33; 'actual': 0.34; 'subject:the': 0.34; 'problem': 0.35; 'subject:with': 0.35; "can't": 0.35; 'editor': 0.35; 'point.': 0.35; 'earth': 0.36; 'received:com.au': 0.36; "didn't": 0.36; 'method': 0.36; 'shows': 0.36; 'useful': 0.36; 'charset:us-ascii': 0.36; 'error.': 0.37; 'wrong': 0.37; 'list': 0.37; 'skip:o 20': 0.38; 'sometimes': 0.38; 'thank': 0.38; 'easiest': 0.38; 'received:211': 0.38; 'to:addr:python-list': 0.38; 'subject:" ': 0.39; 'to:addr:python.org': 0.39; 'how': 0.40; 'even': 0.60; 'is.': 0.60; 'new': 0.61; 'john': 0.61; 'content- disposition:inline': 0.62; 'kind': 0.63; 'real': 0.63; 'more': 0.64; 'virus': 0.65; 'worth': 0.66; 'between': 0.67; 'close': 0.67; '20,': 0.68; 'line,': 0.68; 'yourself': 0.78; 'discovered': 0.83; 'colour': 0.84; 'bounce': 0.91; 'cutting': 0.91; 'mistake': 0.91; '2013': 0.98
Date Thu, 20 Jun 2013 13:11:13 +1000
From Cameron Simpson <cs@zip.com.au>
To python-list@python.org
Subject Re: Problem with the "for" loop syntax
MIME-Version 1.0
Content-Type text/plain; charset=us-ascii
Content-Disposition inline
In-Reply-To <CAPTjJmqJeab8aCihPxbTqhUYkyD089FuftTRLfhMsYTg3J+ZaA@mail.gmail.com>
User-Agent Mutt/1.5.21 (2010-09-15)
References <CAPTjJmqJeab8aCihPxbTqhUYkyD089FuftTRLfhMsYTg3J+ZaA@mail.gmail.com>
X-Optus-CM-Score 0
X-Optus-CM-Analysis v=2.0 cv=K8x6hFqI c=1 sm=1 a=wom5GMh1gUkA:10 a=GZs24lQ_rmAA:10 a=kj9zAlcOel0A:10 a=vrnE16BAAAAA:8 a=ZtCCktOnAAAA:8 a=0n0nKMa5IkwA:10 a=pGLkceISAAAA:8 a=toJHS-rCAAAA:8 a=TpEw3CSrtDuNLv0SX_0A:9 a=CjuIK1q_8ugA:10 a=MSl-tDqOz04A:10 a=ChdAjXE5lkUvdteQbhpnkQ==:117
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.3605.1371697883.3114.python-list@python.org> (permalink)
Lines 44
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1371697883 news.xs4all.nl 15868 [2001:888:2000:d::a6]:35757
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:48769

Show key headers only | View raw


On 20Jun2013 11:09, Chris Angelico <rosuav@gmail.com> wrote:
| On Thu, Jun 20, 2013 at 11:02 AM, Arturo B <a7xrturodev@gmail.com> 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 <cs@zip.com.au>

Are you experiencing more Windows95 crashes than the norm? How on earth
would you _know_?       - John Brook <johnb@research.canon.com.au>
                          reporting about a new virus

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: Problem with the "for" loop syntax Cameron Simpson <cs@zip.com.au> - 2013-06-20 13:11 +1000

csiph-web