Newbie: unexpected indenting error

Ben Finney ben at benfinney.id.au
Sun Jul 13 09:09:54 CEST 2014


Martin S <shieldfire at 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




More information about the Python-list mailing list