Skip to content

Instantly share code, notes, and snippets.

@shafiahmed
Forked from RobertAKARobin/python.md
Created October 12, 2019 20:40
Show Gist options
  • Save shafiahmed/a52469fa5a6992c7cf155d1298ef87e6 to your computer and use it in GitHub Desktop.
Save shafiahmed/a52469fa5a6992c7cf155d1298ef87e6 to your computer and use it in GitHub Desktop.
Python Is Not A Great Programming Language

Python is not a great programming language

Let me start off by saying what is nice about Python:

  • The philosophy of "one correct way to do things."
  • Easy to learn (at the start).
  • Pretty complete standard libraries.
  • A huge ecosystem of good third-party libraries.
  • Forced indentation. It's a mixed bag, but I've worked with too many junior developers who would never have indented otherwise.
  • The import system makes it easy to trace the filepath for any dependency.
  • """Docstrings"""

Now what's bad. TLDR: it's great for beginners, but then its syntax turns everything into a mess.

  • The syntax for classical inheritance. Half of each Django app is super().__init__(*args, **kwargs). At least you don't have to pass arguments to super anymore.
  • Too many magic __double-underscore__ methods and properties that you have to just memorize.
  • Too many top-level built-in functions that (a) you have to just memorize, and (b) get really ugly. You end up with stuff like list(map(...)). I haven't used so many nested parentheses since my early days in PHP. Guido's explanation makes sense in theory, but is really annoying in practice.
  • Too many other weirdo bits of magic syntax, like [list comprehensions].
  • Django specifically is so full of magic words, and its documentation is so convoluted, that I've basically given up on documentation altogether and just look at the Django source code now.
  • Needing to put dict property names `{'in': 'quotes'}.
  • You have to cast your data back to a list/tuple after using enumerate() and map().
  • Different syntaxes for lists and tuples.
  • foo['bar'] returns a KeyError, so you have to do foo.get('bar')... or in some cases getattr(foo, 'bar', None), but not in others because getattr and .get are different things.
  • You can't just tack on flags to /regular_expressions/ig.
  • All the goofy string literals: f' ', u' ', r' ', etc.
  • Pipfile does not work that well.

I didn't really like Ruby until I started writing Python.

(Disclaimer: a big part of my frustration comes from having a JavaScript background. I know JavaScript is a "bad" language, so I was really excited to learn a "good" one... only to be disappointed in Python for many of the same general reasons JS is "bad.")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment