python script logo

What are the main weaknesses of Python as a programming language?

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.,, which means that we might expect him to continue to get things wrong in the future.

Some examples:

  • 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.
  • eval

    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.

View Answer on Quora


One comment

  1. this post is really bad and you don’t understand python. python scope is very simple, to find a variable python looks in the local function, then the enclosing function, then the global scope, then the builtins. i don’t know why you think python is a block structured language, it’s not.

    python is typed. it’s just dynamically typed. if you don’t like this, don’t use python. “python doesn’t have the typing system of my favorite language” is not a language weakness.

    an argument about syntactic whitespace? oh lord. i’m going to stop reading this now


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s