Reply to post: Re: Syntactic whitespace

House of pain: If YAML makes you swear, shout louder – the agony is there for a reason

doublelayer Silver badge

Re: Syntactic whitespace

I like Python, but there are several issues that at least have to be acknowledged, even if we're going to decide we can deal with them.

The syntactic whitespace got us here, so let's start with that. It's annoying because the boundaries of control flow are no longer clear. An expression could be inside or outside a block just because someone forgot to change the indentation. In languages which use braces to mark blocks, that will result in a compiler error under most cases. This makes errors more likely. It also makes copying and pasting code harder, because there's a chance the person re-indenting something which does not originally align will make a mistake which won't be caught until runtime starts to go surreal. I don't exactly mind syntactic whitespace if only because it makes others indent properly, but that's not usually a good enough excuse for it.

There are a few other design decisions of Python which can be counterproductive. It has almost completely eliminated pre-runtime checks of any kind. That makes the interpreter simpler, but it makes simple typos or incorrect thinking harder to resolve. A few language features complement this problem. For example, the fact that objects and classes are completely open and that variable creation and variable binding (assignment) are syntactically identical. This opens new classes of typos because nobody will check that the variable you want exists until right when you ask for it. Fuzzing is therefore more important in Python just to catch things another language would get during compilation.

These issues are not shallow, but nor do they eliminate Python as a useful language. I think it's great for prototypes or for various tasks which other languages make painful. I would much rather use Python to do string parsing than most other languages. And a well-tested Python program can be a core component in something without problems. Still, it's imperfect in various ways.

POST COMMENT House rules

Not a member of The Register? Create a new account here.

  • Enter your comment

  • Add an icon

Anonymous cowards cannot choose their icon