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


Groups > comp.lang.python > #74401 > unrolled thread

Re: Newbie: unexpected indenting error

Started byMartin S <shieldfire@gmail.com>
First post2014-07-13 11:03 +0200
Last post2014-07-13 11:03 +0200
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Newbie: unexpected indenting error Martin S <shieldfire@gmail.com> - 2014-07-13 11:03 +0200

#74401 — Re: Newbie: unexpected indenting error

FromMartin S <shieldfire@gmail.com>
Date2014-07-13 11:03 +0200
SubjectRe: Newbie: unexpected indenting error
Message-ID<mailman.11788.1405242219.18130.python-list@python.org>
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 <gherron@digipen.edu>:
> 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

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web