Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!gandalf.srv.welterde.de!weretis.net!feeder4.news.weretis.net!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed2a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.005 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'subject:error': 0.03; 'elif': 0.05; 'editor.': 0.09; 'spaces': 0.09; 'martin': 0.11; 'def': 0.12; '"unexpected': 0.16; 'accepts': 0.16; 'calculator': 0.16; 'indent': 0.16; 'mixture': 0.16; 'tabs': 0.16; 'two,': 0.16; 'thanks,': 0.17; 'wrote:': 0.18; 'code.': 0.18; 'work,': 0.20; 'coding': 0.22; 'looks': 0.24; 'header:In-Reply-To:1': 0.27; 'to:2**1': 0.27; 'am,': 0.29; 'mix': 0.30; 'message- id:@mail.gmail.com': 0.30; 'code': 0.31; 'that.': 0.31; 'apparently': 0.31; 'closer': 0.31; 'gary': 0.31; 'indentation': 0.31; 'file': 0.32; 'problem': 0.35; 'editor': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'doing': 0.36; 'error.': 0.37; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'first': 0.61; "you've": 0.63; 'within': 0.65; 'institute': 0.72; 'dr.': 0.77; 'deceiving': 0.84; 'rating': 0.93 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=KJJq2ccLQLlKV9GPP7fWaP60Ety6M3OIkAu64IST9ig=; b=f3LG2wJ5yoAcprxKF7M0EGMEGFd/kTWQ9W90NhhRdZTLZIPJktepw7S+7l7M/eoM11 6xe1y5yr8jT5jBUWGRNhQQn4RVmji123vpEmO6rgE044XBI2diPHsHlFUJAkbvFfqf4O w+vYCZ9uQxA3kTlLJ/gPKzO18UbONKb/6UXgsQ/L+YbrnWahzKQkvMn80l5BTX+QGkWJ J4KFAmFnJWApmMp+SIgnpNuzLZedI2m6U6qX+tCpV4clNq1LIf7e6JMSrcTBJfpbxM6s Ye/DG1bP2VrhiVzT1UiqzPY1nvnHq2YBvgXacbdh2eYLXp76AY2kSufVjnIaE1954LSL izXw== MIME-Version: 1.0 X-Received: by 10.58.34.169 with SMTP id a9mr9512938vej.5.1405242210907; Sun, 13 Jul 2014 02:03:30 -0700 (PDT) In-Reply-To: <53C2350E.5050307@digipen.edu> References: <53C2350E.5050307@digipen.edu> Date: Sun, 13 Jul 2014 11:03:30 +0200 Subject: Re: Newbie: unexpected indenting error From: Martin S To: Gary Herron , python-list@python.org Content-Type: text/plain; charset=UTF-8 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 57 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1405242219 news.xs4all.nl 2866 [2001:888:2000:d::a6]:58482 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:74401 Thanks, the problem was apparently a mix of way to indent the code. It's confused the H out of the editor. Using standard indentation solved the error. 2014-07-13 9:28 GMT+02:00 Gary Herron : > On 07/13/2014 12:01 AM, Martin S wrote: >> >> While coding a rating calculator I am using a for-loop within >> if-elif-else. >> When using the for-loop in the first if instance my editor accepts >> this, but when using the same for-loop within the elif instance it >> complain about "unexpected indent". >> >> Like so: >> >> def function(x): >> if rdiff >=500: >> for .... >> [do stuff] >> elif rdiff >=410: >> for ... <== unexpected indent >> [do other stuff] >> >> >> What the...? What am I doing wrong? >> (hopefully the indents translate; else def, if/elif, for and [dostuff] >> are indented) >> >> /Martin S > > > The code looks OK, but looks can be deceiving if you've manage to mix tabs > and spaces to achieve that. > > Check for a mixture, and settle on one. Tabs would work, but the > recommendation is to use spaces. > > If you don't have a mixture of the two, then we have a mystery. Send your > file as an attachment, and we'll take a closer look at it. > > Gary Herron > > > > -- > Dr. Gary Herron > Department of Computer Science > DigiPen Institute of Technology > (425) 895-4418 > -- Regards, Martin S