Python indentation deters newbies?

simo simoninusa2001 at yahoo.co.uk
Mon Aug 16 18:02:19 CEST 2004


Peter Hansen <peter at engcorp.com> wrote:

[snip]
> > I'm a Perl programmer at heart - well that and PHP, plus the odd
> > dabbling in C/C++/C# etc.

> > Anyway, the thought of indentation instead of curly braces really put
> > me off to start with, 

> Ah, good.  Someone who was really there, instead of hearsay.

Hehe, thought that said "heresy" for a moment! ;o)

> Please, *why* did it put you off?

I really don't know, just opposition to change, I'm ashamed to say! I
just couldn't think how you would enclose areas of code without braces
- until you've seen some properly indented Python source, it is hard
to visualise.

> Didn't you already indent your code consistently?

Yes, personally, but sometimes it's hard when you're working on code
that has been used by 3 other people with different indentation habits
and even different editors - for example, one chap here uses two
spaces to ident, whereas I've always used 4, nothing like coding
standards eh?!

> Didn't you think that the removal of those braces would immediately
> make the code more readable (fewer lines, fewer extra cruft to
> distract the eye) and easier to type?

The removal of things like $ @ % { etc. appealed to me (then those
fsckers went and put @decorators into 2.4!)
 
> I'm curious why more people don't have "neat!" as their very
> first thought on encountering this, rather than "yuck!".

Possibly unfathomable, all I can say is it's opposition to change
(practically every other language does the braces thing) and also it's
hard to visualise until you see a big chunk of Python code - a "Hello
World!" doesn't really show the benefit of removing all that junk.

I have a C++ programer friend who thinks Python is a joke and is not
OOP as it doesn't have proper encapsulation, can you imagine getting
him to lose his braces? (wow that came out wrong!)



More information about the Python-list mailing list