Why indentation is use to denote block of code?

AggieDan04 danb_83 at yahoo.com
Sun Sep 13 20:38:31 EDT 2009


On Sep 13, 6:27 pm, Steven D'Aprano <st... at REMOVE-THIS-
cybersource.com.au> wrote:
> On Sun, 13 Sep 2009 15:15:40 -0700, Chris Rebert wrote:
> > In fact it's pretty much impossible to automatically indent Python code
> > that has had its indentation removed; it's impossible to know for sure
> > where the dedents should occur.
>
> Just like most other syntactic elements -- if you remove all the return
> statements from Python code, or dot operators, it's impossible to
> automatically add them back in.
>
> The only difference is that some (badly written?) applications mangle
> leading whitespace, but very few feel free to remove other text on a whim.
>
> I don't recall actually using a mail client or newsreader that removes
> leading whitespace when posting, but I've occasionally seen posts from
> others with all indentation removed, so presumably such badly-behaved
> applications do exist.

I haven't seen it in a mail client, but it's very common in internet
forums.



More information about the Python-list mailing list