On Friday, November 19, 2010 03:18:23 pm Jonathan P Jacky wrote: > Richard, > > I haven't used ipython, so I can't give a specific answer. In the python > shells I have used (python and IDLE), I find that indentation is tricky > and sometimes doesn't work for reasons that aren't clear to me. > > Jon
python uses indentation for scoping ( thus ending the argument about whether starting braces should be on the same line or the next line). the key thing to remember is to use the same scheme for indentation throughout your file ( or terminal session). You can use 1, 2, 3, 4, etc spaces or tabs BUT you have to remember to use the same scheme throughout your code ( file or session). 2 or 4 spaces work pretty well and it's good to be consisten. here's some references which might help clear it up for folks who may not be aware of this: http://en.wikipedia.org/wiki/Python_(programming_language)#Indentation http://diveintopython.org/getting_to_know_python/indenting_code.html ( great book btw!) http://docs.python.org/reference/lexical_analysis.html#indentation this post brings back some 'make' memories =) cheers, -- Nimret Sandhu http://www.nimret.com http://www.nimsoft.biz
