Newbie: White space

Ryan Abrahams abrahams at wizards.net.au
Thu Mar 23 10:24:45 CET 2000


Right, sorry.... I definately did not want to start a flame war....

Mikael Olofsson wrote:

> Ryan!
>
> Welcome to the world of Python. As always, when you learn a new programming
> language, you have to get used to some things. One of the things you have
> to get used to in Python is the use of indentation.
>
> On 23-Mar-00 Ryan Abrahams wrote:
>  >  Awwww.... so I am guessing i can not lay it out like I layout my C code....
>
> No, you cannot. Python is not C.
>
>  >  if that is so, then how can you increase readability,
>
> Because indentation is required. It replaces the curly braces in C. You
> are simply forced to use indentation to describe the logical structure
> of your code, as you are forced to use curly braces in C.
>
>  >  or is Python just all
>  >  up against the left hand margin???
>
> No, see pehrs posting.
>
> if condition:
>     what goes in this level
>     belongs to the if statement.
> what goes in this
> level does not.
>
> The same holds for for, while, ...
>
> if you need another if ... or a for ... inside your if ... above, you
> simply indent further.
>
> Read the documentation, and please do not make this into another flame
> war about whitespace. We've had enough of them, and nothing we say in
> the matter will change how indentation works in Python.
>
> Have fun!
>
> /Mikael
>
> -----------------------------------------------------------------------
> E-Mail:  Mikael Olofsson <mikael at isy.liu.se>
> WWW:     http://www.dtr.isy.liu.se/dtr/staff/mikael
> Phone:   +46 - (0)13 - 28 1343
> Telefax: +46 - (0)13 - 28 1339
> Date:    23-Mar-00
> Time:    08:47:02
>
> This message was sent by XF-Mail.
> -----------------------------------------------------------------------






More information about the Python-list mailing list