Why I Hate Python (Or Any Dynamic Language, Really)

A project I'm currently doing for work involves a custom server-side component. Ordinarily I would reach straight for D and Vibe.d. (In fact, D and Vibe.d are already making development go very smoothly on a light-weight "not-a-blog" system I'm developing...at least in the rare cases I can actually spend any time on it...) Unfortunately, this project came with an unwavering pointy-hair decree that I must use either PHP or Python. (BTW, If you think you know who it was, you're probably wrong.)

Naturally I didn't hesitate to choose "Anything but PHP".

But, it's worth noting the big reason behind the "PHP or Python" limit was the usual false-dichotomy bullcrap about "getting shit done" that's frequently used by dynamic fans. About the only argument that made any sense at all was that a lot of people know PHP and Python and could pick up the codebase later (It's always nice to know you're coding your way towards expendability.)

Whatever, fine. Python it is.

So, long story short, I found this page which pointed me to some relevant libs, and I figured I'd try Flask first.

I went to download Flask (BTW, if I see one more language or lib claiming on its homepage to be "fun!", I'm gonna kill someone). But Flask showed nothing but a Linux release. WTF? I thought Python was supposed to be at least vaguely cross-platform? Searched around and found some obscure corner of the net that happened to actually explain how to install it on Windows. Ok, so I installed the prerequisite PIP, I do the "pip install flask"...and the system couldn't find PIP. More digging...Oh great, back when I had to put the Python directory into my PATH manually, despite having used an actual Python installer, I was apparently supposed to also know to add the 'Scripts' subdirectory. Clear as mud.

Fine, done. Try again...And I get some big useless "Traceback" vomit. (I swear, when trying to use Python "software", I get more "Traceback" bullshit than actual "Ok boss! Done!".) Buried in that garbage is some line of sourcecode involving a string literal mentioning something about needing a "PyFlakes". Ehh, what the hell, let's just try "pip install pyflakes". Nah, no dice, just more barf.

Meh, whatever, fuck Flask for now, let's try Bottle. Apparently it's supposed to be low-bullshit anyway, so sounds good. Wow, this one actually installs. And the "hello world" source on their website works! Hot damn, we're in business.

So I modify the hello world. And I look up how to change the content type, because I know I'm going to need to spit out binary data on this project. And...uhhh...the content type didn't fucking change. It's still spitting out 'text/html'. Errghh...So I blow nearly half an hour digging through the docs for something I may have missed, go back over my code...nothing. Try to find someplace to ask, find a buried link to a mailing list (I hate mailing lists), and start writing for help. Then, by pure chance, I happen to notice it:

from bottle import route, run, request, response @route('/foo') def index(): request.content_type = 'application/octet-stream' return 'Blah' run(host='localhost', port=8181)

Do you see the problem? I mean, aside from the flawed idea of indent-scoping and the goofy underscore_naming_convention. Yea...Obviously "content_type" is a property of the response, not the request. Of course, Python couldn't have told me 'request' didn't have a member 'content_type' and ended the matter right then and there. No, it had to string me along, doing anything except let me know something was wrong.

If this is a dynamic coder's idea of "getting shit done", then they can blow me.

Oh, sure, you never make stupid mistakes like that, right? There's a term for programmers who don't make dumb mistakes: Goddamned LIARS.

After fixing it to "response" we can still have some more fun with this:

response.content_typePOOP_SHITS_FUCK = 'application/octet-stream'

Still runs! Wrongly! Even though I'm damn certain the Bottle developers didn't put any "POOP_SHITS_FUCK" into their API.

Why the fuck should any of that even compile? That's what I hate about these dynamic turds, they happily let you do completely nonsensical shit, just for the fuck it. "Oh, but this means you can stick random extra garbage into any object you want!" Gee, great. Just what I've never wanted.

Here's another wonderful feature I never wanted:

from datetime import date ... response.content_type = date.today()

Holy hell, my content type is a fucking day and Python happily spits out the resulting gibberish. Gee, it's not a bug, it's a feature! (Hmm, happily doing the non-sensical? No wonder it's named after Monty Python[1].) "But what if you wanted to..." Lemme just stop you there. The day I want to do something like that is the day I want my head bashed in.

"But it's just doing what you clearly told it to!" Great, I see we're already forgetting something about "programmers who don't make mistakes". Now, I don't like software that second-guesses me any more than anyone else, but when I fuck up (as we all do) and tell my computer to do something that doesn't even make sense, I expect it to tell me so, not use it as an excuse to run around fucking shit up. If I hand you a gun and say "Shoot the fribstitch", I expect you to say "What the fuck is a fribstitch?", not start blasting away hoping to hit it.

So let's recap: Dynamic typing helps you "get shit done" by giving you the freedom to do useless nonsensical things, write to properties that don't even fucking exist, and generally do things that are either outright bugs or are convoluted enough to invite bugs. Then, instead of letting the compiler eliminate entire classes of these bugs, you're encouraged to take the time to write extra unittests to catch some of them instead of, you know, just "getting shit done".

If I'm gonna "get shit done", then I expect my language to help me avoid bugs, not help me make them.

[1] I am indeed a fan of Python the Monty. Just not Python the Dynamic.

22 comments for "Why I Hate Python (Or Any Dynamic Language, Really)"

  1. (Guest) isomorph
    2012-10-21 00:25

    LMFHO i couldn't have said it better. learning JS right now--i know, just shoot me--because i got a web app to build and there is nothing else running client side. i can't believe that we've been stuck with this garbage for more than 15 years now. i remember when netscape was pushing it. a took 1 look and my stomach heaved. that was it for me. had i not had c/c++, and later java, it would have been the monastery somewhere far away from the madness. server-side there seems to be now an inordinate amount of juvenile enthusiasm for something called node.js. thank god there is scala, akka, and typesafe. didn't know about D until yesterday. problem is, there are all these libraries available now to speed up development server-side with dynamic languages. don't know what D has, but if one has to reinvent the wheel... well you get my point.

  2. 2012-10-21 13:44

    Yea, funny thing about JS and Python: As horrible as JS is, even *it* at least has optional static type annotations in later versions of the ECMAScript spec. Python doesn't even have that.

    The big server-side lib for D is Vibe.d < http://vibed.org >. I use it and I highly recommend it. It's sorta like node.js except it doesn't suck.

    D also has this set of libs: < https://github.com/adamdruppe/misc-stuff-including-D-programming-language-web-stuff > It's not very well documented, but it has a lot of web-related stuff, including a D server-side HTML DOM, which is very cool. I use it instead of the HTML templating engine that's built into Vibe.d.

  3. (Guest) isomorph
    2012-11-01 20:37

    thanks. greatly appreciated.

  4. (Guest) isomorph
    2012-11-10 02:31

    hey! i was wrong regarding being stuck with JS. just stumbled today onto Google's new language whose goal is to get rid of JS, at least on the front -end. the language name is: DART. at first glance, looks like a better tool than JS.

  5. (Guest) sudo !!
    2013-02-20 11:53

    The only dynamic language I tolerate is Java. Others? Go to hell.

  6. (Guest) guest
    2013-02-23 12:12

    Is Java a dynamic language? I don't think so...

    At least that's what I would have said if you asked me off-hand.

    But reading wikipedia it looks like Java *could* fit into the definition of a statically typed dynamic language.

    Learned something new.

  7. (Guest) Milan
    2013-07-09 21:10

    I was debugging my WordPress plugin for the past 26 hours and naturally, after no progress whatsoever, I have decided to type "fuck dynamic languages" into Google, and that is how I get here.

    Thank you for the article.

  8. (Guest) guest
    2014-01-06 08:46

    Python has its own cons, but mistakes you've made just make me laugh. You are shitty programmer and thats it.

  9. 2014-01-11 20:06

    @guest: For the third time, since the first two mentions were *cough* mistakenly overlooked:

    "There's a term for programmers who don't make dumb mistakes: Goddamned LIARS."

    What separates the good programmers from the rest, as with *any* form of engineering, is the ability and willingness to recognize that inevitable fallibility and plan for it, minimizing its impact.

    All people fuck up. But the true talent are those smart enough to have already set up failsafes.

  10. (Guest) guest
    2014-01-22 13:40

    I always joke and say that you can judge a programmer by what they blame:
    The novice blames the OS;
    The intermediate blames the middleware (<--- you);
    The craftsman blames himself.

    On this whole page I found only 1 truth, and that was your sub-title:
    "Inflammatory rants"...

    All of the best mate.

  11. 2014-01-28 03:12

    That's an old saying and people constantly interpret it wrong.

    The craftsman blames himself *because* it's his responsibility to pick the right tool (and *then* use it correctly).

    Being a good craftsman is NOT about grabbing any random junk and expecting to do an adequate job with something ill-suited for the task. I don't understand where so many people keep getting such a bizarrely twisted and nonsensical interpretation.

    If you drive a nail with a hammer and fail: Your fault for using the hammer wrong.

    If you drive a nail with a screwdriver and fail: Your fault, but only because you made a moronic choice by selecting the screwdriver in the first place.

    It doesn't matter one bit whether it's the screwdriver's fault or the craftsman's fault for picking the screwdriver. That distinction, as well as the entire blame-game it comes with, is semantic bullshittery. Doesn't matter what's to blame; what's important is that using a screwdriver to drive a nail is moronic.

    ...Just like using a dynamic language to write non-trivial software. And no amount of trite proverbs, let alone misinterpreted ones, can change that.

  12. (Guest) The_Frenchman
    2014-05-14 10:35

    Thank you so much for the good laugh.

    After spending an entire afternoon trying to figure out why Mr. Python kept evaluating to True the critical "If x < y:" line in my code, regardless of x's and y's values of course, I finally nailed it: x was a good old float but y was a.. string. My bad, ok, i'll admit to forgetting the appropriate type casting. I suppose strings are implictly valued to 0 or something so comparing numbers with them can "get the fuck done"...

    Boiling with wrath (unlegitimate I'm sure, easy, easy Python Ayatollahs), I decided for some reason to try and soothe it down by googling "Python is ****" which brought me to your fribstitch article... Hilarious and thoughtful.

  13. (Guest) guest
    2014-05-14 16:23

    Google fuck Python. Was not disappointed.

  14. (Guest) guest
    2014-05-14 16:27

    Oh and I almost forget : http://benchmarksgame.alioth.debian.org/u32/benchmark.php?test=all&lang=php&lang2=python3&data=u32

    Yes... they both are shitty languages but Python is even much more slower than PHP >_<

  15. (Guest) FUCKPYTHON
    2014-06-09 03:22

    Python was made by crazy monkeys ...

  16. (Guest) alex.k
    2014-06-17 13:35

    I feel your pain!
    You've just described my Python experience.

  17. (Guest) guest
    2014-06-24 16:16

    But look at the bright side
    While it allows you to write bull shit code, it will force you
    to indent it correctly.

  18. 2014-07-15 10:21

    > While it allows you to write bull shit code, it will force you
    to indent it correctly.

    Hah! I like that! :)

  19. (Guest) Kalrish
    2014-08-27 16:25

    I found the article as others have mentioned, and it likewise made me smile :). Perhaps I am too dumb or haven't really given Python an opportunity, but I too feel the same. Programming languages, in the first place, serve to offer concepts over the raw stream of bytes; what's the purpose of a language without strict types, that allows for such nonsensical, non-obvious behaviour? With SCons I already had some problems, and the same happened for some simple tools that I decided to implement with Python that ended up not being so simple. It seems as if what you get with the 'dynamic' part is what you later pay guessing how some trivial things are happening. For now, I'll keep with C++ :).

    (Again, this is just my current feeling. I realize that I might not have had a real experience with Python, and that it could change.)

  20. (Guest) guest
    2014-09-14 10:23

    Python was intended as an educational language and so on every opportunity it gets it tries to make you limp along to a new enlightmentment.
    Getting shit down isn't even remotely in the scope and nor is getting you just the info you need to fix your error.

    This is surely awesome if all you do is sit at some university getting knowledge stuffed up your ass.

    In other contexts, it can be a bit bewildering why you're told there was an unexpected end of the line, and that that occured while it was scanning a literal that was apparently a string instead of simply saying missing "/' in line 1510.

  21. (Guest) guest
    2014-12-04 01:34

    Yes, this, thank you.

    Fuck Python.

    I don't care for your inflammatory 'anything but PHP' nonsense though.

  22. (Guest) Steve
    2015-03-01 18:08

    When I heard someone said "Dynamic language could have beated statical language", I immediately searched "Fuck dynamic language", the "language" doesn't ends with a 's', is because I hated it from my bones. Nevertheless it ends up leading me to here, and expressed half of my feeling towards the "dynamic language", but he doesn't mentioned that so many "popular tools" are based in "dynamic language": Angular, Web.py, Ruby in rails, node.js and sort, where the common point among them is, they are totally non-sense bullcrap that you have to invest in a lot of time to debug just for one god-damned line of mistake, however the "programmer of nowadays" use them, and often leads to bloat-wares that you would screw you life by reading their documents oftenly, and I finally give up learning the "dynamic language", people who use "dynamic language" is the same who use BASIC and need to be corrected immediately, or otherwisr they will kill the normal and turn non-sense into new "normal".

    *Forgive my swear, but BASIC is the bullshit-est even far ahead of dynamic languages, people who uses BASIC as their primary programming language don't even know what the fuck is structure but know what the fuck is goto and spagetti code.

Leave a comment