Answer by Jesse Tov:
The essence of my complaints with Python boils down to two things:
- Much of the language consists of special cases rather than general features that combine in orthogonal ways. This results in infelicities and weird corner cases.
- Guido van Rossum has a history of getting the language design really wrong (e.g., http://neopythonic.blogspot.com/2009/04/tail-recursion-elimination.html), which means that we might expect him to continue to get things wrong in the future.
- Python has perpetual scope confusion. As far as I can tell, this is because van Rossum didn’t understand lexical scope initially, so he got it wrong. (This isn’t a problem unique to Python. It seems pretty common among early versions of scripting languages.) Originally, Python was dynamically scoped, which everyone but RMS agrees is wrong. Then they did away with the dynamic scope, but made it so that inner scopes couldn’t even see variables from outer scopes, which is bizarre in a supposedly block-structured language. Now inner scopes can see outer scopes but can’t mutate them, which is bizarre in a supposedly object-oriented language. Some may claim this is a feature, but it’s an accident of implementation. I’m sure when he fixes that, he’ll break something else.
- David Parnas invented information hiding more than three decades ago, but it’s “unPythonic,” so Python is missing probably the biggest advance in programming since FORTRAN 2.
breaks alpha-equivalence — that is, you can’t arbitrarily change the names of variables, because some variable occurrences can hide in strings, which makes the binding structure of Python undecidable.
- Python is untyped, which means that a whole bunch of errors that are easily detected ahead of time aren’t detected in Python until they happen. Some people like it that way — and more power to them! — but it’s always worth considering whether it’s a misfeature for your particular application
- Syntactic whitespace can be nice, but it makes code generation harder than it has to be. This isn’t a difficult problem to solve. Haskell lets you use either syntactic whitespace or an equivalent syntax involving curly braces and semicolons. One is good for people and the other for metaprogramming, and there’s no good reason not to support both. It doesn’t help that when people have requested this, Python’s implementors have been really snotty about it. (Try
- Limiting the bodies of
s to be expressions rather than statements is arbitrary and annoying. That variable declarations and assignments are statements rather than expressions is arbitrary and annoying. The statement/expression distinction is arbitrary and annoying.
- “The [hash table] is a stark data structure.” Python, like the other table-based languages, encourages you to use “mappings” for many things where sum-of-products (algebraic) datatypes would be more appropriate. This is inefficient, but more importantly, it’s error-prone. To continue quoting Perlis, “Programmers are not to be measured by their ingenuity and their logic but by the completeness of their case analysis.” Python’s lack of support for appropriate data structures encourages program structure that hides case analysis.
All that said, I’d still rather work with Python than PHP or C++. But that’s like saying I’d rather eat Jack in the Box than McDonald’s. It might be slightly more palatable, but it’s still pretty bad.