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


Groups > comp.lang.python > #48792

Re: Problem with the "for" loop syntax

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From Neil Cerutti <neilc@norwich.edu>
Newsgroups comp.lang.python
Subject Re: Problem with the "for" loop syntax
Date 20 Jun 2013 13:55:24 GMT
Organization Norwich University
Lines 26
Message-ID <b2gfucFaqqgU1@mid.individual.net> (permalink)
References <CAPTjJmqJeab8aCihPxbTqhUYkyD089FuftTRLfhMsYTg3J+ZaA@mail.gmail.com> <20130620031113.GA85034@cskk.homeip.net> <mailman.3621.1371735593.3114.python-list@python.org>
Mime-Version 1.0
Content-Type text/plain; charset=us-ascii
Content-Transfer-Encoding 7bit
X-Trace individual.net K23Gw6rZTc/JFtMRbqBLKAXsT2cgiGPfqhT4uX7vdgtd4z2f2A
Cancel-Lock sha1:nkSraSCA55tx2a1Pji4p57mG61I=
User-Agent slrn/0.9.9p1/mm/ao (Win32)
Xref csiph.com comp.lang.python:48792

Show key headers only | View raw


On 2013-06-20, Joshua Landau <joshua.landau.ws@gmail.com> wrote:
> On 20 June 2013 04:11, Cameron Simpson <cs@zip.com.au> wrote:
>> 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.
>> 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.
>
> Thanks for that, that's quite an ingenious technique.

The auto-indent feature of Vim catches this type of syntax error,
and I imagine other good autoindent support will do the same.
After I press enter and the following line's indent isn't what I
expect, it is nearly always due to a missing bracket, quote or
colon.

So if you press enter and the autoindent is unexpected, don't
just press space or backspace to fix it. It's usually a sign of
an earlier syntax error, so look for that first.

-- 
Neil Cerutti

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


Thread

Re: Problem with the "for" loop syntax Joshua Landau <joshua.landau.ws@gmail.com> - 2013-06-20 14:39 +0100
  Re: Problem with the "for" loop syntax Neil Cerutti <neilc@norwich.edu> - 2013-06-20 13:55 +0000
    Re: Problem with the "for" loop syntax Chris Angelico <rosuav@gmail.com> - 2013-06-21 01:45 +1000
    Re: Problem with the "for" loop syntax Cameron Simpson <cs@zip.com.au> - 2013-06-21 08:38 +1000
      Re: Problem with the "for" loop syntax Neil Cerutti <neilc@norwich.edu> - 2013-06-21 14:36 +0000

csiph-web