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


Groups > comp.lang.python > #74399

Re: Newbie: unexpected indenting error

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.mixmin.net!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed1a.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.011
X-Spam-Evidence '*H*': 0.98; '*S*': 0.00; 'subject:error': 0.03; 'parser': 0.07; 'pep': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'recommends': 0.09; 'spaces': 0.09; 'martin': 0.11; 'python': 0.11; 'posted': 0.15; 'finney': 0.16; 'highlight': 0.16; 'indent': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'demonstrate': 0.16; 'code.': 0.18; 'example': 0.22; 'header:User-Agent:1': 0.23; "haven't": 0.24; 'header:X-Complaints-To:1': 0.27; 'characters': 0.30; 'code': 0.31; 'too.': 0.31; 'though.': 0.31; 'writes:': 0.31; 'run': 0.32; 'text': 0.33; 'level.': 0.33; 'plain': 0.33; 'editor': 0.35; 'one,': 0.35; 'doing': 0.36; 'ben': 0.38; 'to:addr :python-list': 0.38; 'anything': 0.39; 'expect': 0.39; 'does': 0.39; 'sure': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'space': 0.40; 'ensure': 0.60; 'remove': 0.60; 'tell': 0.60; 'new': 0.61; "you're": 0.61; 'complete': 0.62; "you've": 0.63; 'show': 0.63; 'different': 0.65; 'skip:\xe2 10': 0.65; 'here': 0.66; 'received:125': 0.84; 'standing': 0.84; 'together,': 0.84; 'giants': 0.91
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Ben Finney <ben@benfinney.id.au>
Subject Re: Newbie: unexpected indenting error
Date Sun, 13 Jul 2014 17:09:54 +1000
References <CAHXoDSDuKsqJ7ceXoUXA3g5K9J0UNRJ7g29uJMPxZEqHQCaCnA@mail.gmail.com>
Mime-Version 1.0
Content-Type text/plain; charset=utf-8
Content-Transfer-Encoding 8bit
X-Gmane-NNTP-Posting-Host jigong.madmonks.org
X-Public-Key-ID 0xAC128405
X-Public-Key-Fingerprint 517C F14B B2F3 98B0 CB35 4855 B8B2 4C06 AC12 8405
X-Public-Key-URL http://www.benfinney.id.au/contact/bfinney-pubkey.asc
X-Post-From Ben Finney <bignose+hates-spam@benfinney.id.au>
User-Agent Gnus/5.13 (Gnus v5.13) Emacs/23.4 (gnu/linux)
Cancel-Lock sha1:qk6zQtjp48UrzyV2bbK9mBn7JOU=
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 <https://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 <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.11786.1405235407.18130.python-list@python.org> (permalink)
Lines 30
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1405235407 news.xs4all.nl 2834 [2001:888:2000:d::a6]:43338
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:74399

Show key headers only | View raw


Martin S <shieldfire@gmail.com> writes:

> What the...? What am I doing wrong?
> (hopefully the indents translate; else def, if/elif, for and [dostuff]
> are indented)

They're all indented by different amounts. I don't see anything that
would cause the parser to tell you “unexpected indent”, though.

For those reasons together, I suspect what you've posted here does not
match exactly what is in your Python code.

My recommendation:

* Instruct your text editor to highlight any U+0009 characters
  (horizontal tab) as an error, and remove them. Indent with U+0020
  SPACE characters only; PEP 8 recommends four spaces per indent level.

* Ensure your emails are composed in plain text (AFAICT, you're already
  doing this), and show us *exactly* a complete example of code that
  will demonstrate the behaviour you're seeing. Make a new one, if you
  need to; just make sure it's complete so you can expect others to be
  able to run it too.

-- 
 \      “If I haven't seen as far as others, it is because giants were |
  `\                           standing on my shoulders.” —Hal Abelson |
_o__)                                                                  |
Ben Finney

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


Thread

Re: Newbie: unexpected indenting error Ben Finney <ben@benfinney.id.au> - 2014-07-13 17:09 +1000

csiph-web