Re: Looking At Python Programming

  • From: David Tseng <davidct1209@xxxxxxxxx>
  • To: programmingblind@xxxxxxxxxxxxx
  • Date: Sat, 4 Jun 2011 14:03:56 -0700

First, usually it helps to also include the output of the console as
it's helpful to get the line number the interpreter flagged.

With that said, Edit.py should not have any indents since you're not
defining any block structures like functions or conditionals.  You've
got a +1 indent on the "script, ... = ..." line and a +2 indent
thereafter.



As for args.py, you're indentation's entirely off.  0 indent for "def
..." (the function keyword in python), and +4 (or whatever you want
just stay consistent) for statements within functions.

As a final aside, when I first learned python a while back when in
undergrad, I found it immensely helpful to fire up the interactive
python shell and start typing.  This includes function definitions,
calling function definitions, etc.  It's a huge perk/advantage of
using an interpreted language like python.  Plus, you get immediate
reinforcement on your correctness of syntax/understanding.  /off
soapbox.



On 6/4/11, Harmony Neil <harmonylm@xxxxxxxxxxxxxx> wrote:
> I can't remember if attachments are permitted on this list or not, so I
> apologize in advance. I've been looking at functions and stuff in the python
> tutorials and although I copied them character for character, as far as I
> know, I get an error saying that there is an unexpected indentation. Would
> anyone be able to let me know if you find any problems with the indentation?
>
> Thanks,
>
> Harmony.
>
>
__________
View the list's information and change your settings at 
//www.freelists.org/list/programmingblind

Other related posts: