[Info-vax] Python (was Re: BASIC)

Lawrence D'Oliveiro ldo at nz.invalid
Mon Jan 15 14:46:04 EST 2024


On 15 Jan 2024 18:50:23 -0000, Scott Dorsey wrote:

>... the indentation syntax in Python drives me insane.

I used a number of different languages over the years, and gradually (and 
sometimes painfully) evolved some common conventions that I have stuck to 
regardless of the language. (You should see how I lay out my Lisp code, 
for example. Oh, and I like to leave off the semicolons in JavaScript as 
well.) By the time I got to Python, I found that its indentation 
requirements actually fitted in fine with the way I like to indent my 
code.

What I didn’t like was the loss of redundancy: in a conventional free-form 
language, you have the statement bracketing and the indentation 
conventions both saying the same thing in different ways. By making the 
indentation act as statement bracketing is well, you lose one of those. So 
I put it back by adding “#end” comments to my code.

This actually serves a couple of purposes:
  * I have custom commands defined in Emacs to jump between lines with
    matching indentation. This nicely takes me between the start and
    end of statement blocks.
  * Some online forums have been known to strip leading blanks when I try
    to post code. Without “#end” comments, this turns Python code into
    complete gibberish. With those comments, there is a chance of being
    able to repair the corrupted code.



More information about the Info-vax mailing list