Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #74401
| References | <CAHXoDSDuKsqJ7ceXoUXA3g5K9J0UNRJ7g29uJMPxZEqHQCaCnA@mail.gmail.com> <53C2350E.5050307@digipen.edu> |
|---|---|
| Date | 2014-07-13 11:03 +0200 |
| Subject | Re: Newbie: unexpected indenting error |
| From | Martin S <shieldfire@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.11788.1405242219.18130.python-list@python.org> (permalink) |
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
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: Newbie: unexpected indenting error Martin S <shieldfire@gmail.com> - 2014-07-13 11:03 +0200
csiph-web