Wednesday, October 12, 2016

Here is where indentation becomes a slight redundancy

import keyword
print ("hello")
print(keyword.kwlist)

The lines above are simple python, it works but the following regurgitates

import keyword
 print ("hello")
print(keyword.kwlist)

The interpreter thinks that simulated tab is the end of a block.

OK, fine, but then the engineer creates the block align button on his tool bar, and that button allows him to cut and paste without fretting indentation, he just hits the button.  At a hundred bucks an hour, you do not want the geek to stop and re-align a block of code for every cut and past.  In fact, not having looked, I am certain that python editors can do that today.

So, then by using the indent, we have at least removed the open and closing bracket.   OK, I can see that.  But, then again, get the intelligent editor.  Treat the bracket as unprintable, and indent on command.

In the end, it is only worth a comment because there is nothing intelligent going on in election season. Python is otherwise a great productivity improvement, its ability to catch its own errors, and manage its own class libraries, from the code, and keeping the simplicity  of basic.  Just watch your indents.

No comments: