Python indentation deters newbies?

Sam Holden sholden at flexal.cs.usyd.edu.au
Mon Aug 16 07:06:37 CEST 2004


On Mon, 16 Aug 2004 00:44:32 -0400, Peter Hansen <peter at engcorp.com> wrote:
> simo wrote:
>
>> 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.
>
> Please, *why* did it put you off?
>
> Didn't you already indent your code consistently?
>
> 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?
>
> I'm curious why more people don't have "neat!" as their very
> first thought on encountering this, rather than "yuck!".

Many moons ago when I first programmed in python I disliked the
use of indentation instead of curly braces.

Solely because I was (and still am) from the tab school of indentation
but when copy-n-pasting sample code from an x-term or a web browser
spaces would get inserted and the code wouldn't be valid.

When writing code this isn't a real problem (since not much copy-n-paste
happens), but when playing around with things and trying stuff out it
makes things more painful than they need to be.

Of course that's a problem with the tools and not with the language - a
better editor would fix that as would "smarter" copy-n-paste.

But it was annoying.

The same thing crops up with Makefiles, but is even more annoying in
that domain.

-- 
Sam Holden



More information about the Python-list mailing list