A modest indentation proposal

phil hunt philh at comuno.freeserve.co.uk
Fri Nov 30 09:25:12 EST 2001


On Thu, 29 Nov 2001 14:09:28 -0800, Erann Gat <gat at jpl.nasa.gov> wrote:
>
>The subject of syntactically-significant indentation seems to dominate a
>lot of discussions on Python.  Personally I've found it to be less of a
>problem than I thought it would be, but annoying nonetheless.  It also IMO
>makes the language unsuitable for mission-critical applications.  It's
>just too easy to screw up indentation (particularly when cutting and
>pasting large blocks of code) without realizing it.

I held off learning Python for a year because I disliked the indentation
so much.

But then when I started learning it, I found it was not a problem, in fact
it makes the program look a lot nicer.

If I ever design a Python-like language, there will be 2 alternate syntaxes,
one with and one without semantic indentation. So people will be able to
write

   if x > 3:
      a := b + c
      print a

or:

   if x > 3: {
      a := b + c;
      print a;                                                                                                    
   }
   
(Though why anyone would prefer the second way is beyond me).

The language would be stored internally in a form resembling the upper
of the two, and there would be automatic translators so everyone could
see it the way they liked, with {} or not, with whatever number of 
characters per indentation they liked, spaces/tabs, etc.

-- 
*** Philip Hunt *** philh at comuno.freeserve.co.uk ***




More information about the Python-list mailing list