Python would be better with brackets

{Python} There. I fixed it.

But really I’m talking about the scripting language. Python requires code lines to be separated onto new lines and then groups code lines based on a set of tabs or spaces before the line.

Better programming languages use semicolons to separate the code lines and brackets to group code. This is better because code is built from other code. If you ever create a large program or set of programs, you’ll know that it is necessary and expedient to copy useful bits of code around. This copying is incredibly easy in bracketed languages in any word processor, it just works. And in smarter development environment editors, the editor software can easily identify the bracket situation and automatically correct the format accordingly.

However, in python, when you go to copy a code group, chances are that you’ll have to go through each line and reconfigure the leading tabs and spaces. Indeed, the only way to avoid this hassle is to use special word processors that have built in functions for managing indents, and that still likely won’t work if spaces or combinations of tabs and spaces are being used.

Others have recognized this problem and developed plug ins, but I’d argue that it is a little silly not to have a native bracketed structure.

But neither python nor the bracketed languages provide a solution for deep nesting readability. To fix this issue, I’d take a lesson from html and permit optional tags when opening a bracket block, that, when assigned, must be added at the closing bracket. Something like {:count-loop codeline;codeline2; count-loop:}.

Leave a Reply