Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Python Is Not A Great Programming Language

Python is not a great programming language.

It's great for beginners. Then it turns into a mess.

What's good

  • A huge ecosystem of good third-party libraries.
  • Multiple inheritance.

What should be good

  • It's easy to learn and read. However, it's only easy to learn and read at the start. Once you get past "Hello world" examples Python can get really ugly and counterintuitive. See below.
  • The Pythonic philosophy that "There should be one -- and preferably only one -- obvious way to do it." As someone who loves working within rules and rigid frameworks, I love this philosophy! As someone who writes Python, I really wish Python actually stuck to this philosophy. See below.

What's "meh"

  • Forced indentation. Some love it because it enforces consistency and a degree of readability. Some hate it because it enforces the wrong consistency. Objectively it's neither good nor bad.
  • Dynamic typing. There are lots of dynamically-typed languages and lots of statically-typed languages. Which kind of typing is better isn't a Python debate, it's a general programming debate.

What's bad

  • 400 ways (more or less) to interpolate strings. This prints "Hello Robin!" 3 times:

    user = {'name': "Robin"}
    print(f"Hello {user['name']}!")
    print("Hello {name}!".format(**user))
    print("Hello %(name)s!" % user)
    

    If there was a unique and obvious use-case for each of these then that would be one thing, but there's not.

  • 69 top-level functions that you have to just memorize. GvR's explanation makes sense in theory, but is really annoying in practice.

  • map and enumerate do not have the same methods as list. So, 99% of the time you either convert them to lists with list(), or you use a list comprehension, which, speaking of...

  • List comprehensions are held up as an excellent recent-ish addition to Python. People say they're readable. That's true for simple examples (e.g. [x**2 for x in range(10)]) but horribly untrue for slightly more complex examples (e.g. [[row[i] for row in matrix] for i in range(4)]). I chalk this up to...

  • Weird ordering in ternary/one-line expressions. Most languages follow a consistent order where first you declare conditions, then you do stuff based the on those conditions:

    if user.isSignedIn then user.greet else error
    
    for user in signedInUsers do user.greet
    

    Python does this in the opposite order:

    user.greet if user.isSignedIn else error
    
    [user.greet for user in signedInUsers]
    

    This is fine for simple examples. It's bad for more complex logic because you have to first find the middle of the expression before you can really understand what you're reading.

  • Syntax for tuples. If you write a single-item tuple (tuple,) but forget the trailing comma, it's no longer a tuple but an expression. This is a really easy mistake to make. Considering the only difference between tuples and lists is mutability, it would make much more sense to use the same syntax [syntax] as lists, which does not require a trailing comma, and add a freeze or immutable method. Speaking of...

  • There's no way to make dicts or complex objects immutable.

  • Regular expressions require a lot of boilerplate:

    re.compile(r"regex", re.I | re.M)
    

    Compared to JavaScript or Ruby:

    /regex/ig
    
  • The goofy string literal syntaxes: f'', u'', b'', r''.

  • The many "magic" __double-underscore__ attributes that you just have to memorize.

  • You can't reliably catch all errors and their messages in one statement. Instead you have to use something like sys.exc_info()[0]. You shouldn't have a catch-all in production of course, but in development it's very useful, so this unintuitive extra step is annoying.

What's bad about the culture

Most programmers will acknowledge criticisms of their favorite language. Instead, Pythonists will say, "You just don't understand Python."

Most programmers will say a piece of code is bad if it's inefficient or hard to read. Pythonists will say a piece of code is bad if "it isn't Pythonic enough." This is about as helpful as someone saying your taste in music is bad because "it isn't cultured enough."

Pythonists have a bit of a superiority complex.

@calebpower

This comment has been minimized.

Copy link

@calebpower calebpower commented Oct 12, 2019

A couple of others:

  • Better Ask Forgiveness Than Permission is a terrible philosophy to default to, and should only be used when reasonably sure that its necessary (as opposed to Look Before You Leap)
  • White space as syntax is reminiscent of RPGLE on AS/400; developers should learn how to write great code, not be forced into a style
  • Tendencies of developers to use it for absolutely everything is sad, but a good measure of how well-rounded a developer is

(Edit) I think points 1 and 3 are my "issues with many of the Python community" rather than "issues with the language" though.

@cmlburnett

This comment has been minimized.

Copy link

@cmlburnett cmlburnett commented Oct 12, 2019

What you don't like about Python seems to me to come from not understanding its underlying data model. I would recommend James Powell's 2017 PyData talk on becoming a Python expert (https://youtu.be/cKPlPJyQrt4).

  • The double underscore "magic" methods are all driven by this model.
  • Generators (and your "need" to cast returns from enumerate() and map()) are driven by this model. (PS, you absolutely do not need to convert the generators into lists as they will quack and walk like a duck when you need them to.)
  • Look at 'bar' in foo and 'bar' not in foo style syntax if you need to test if a key is in a dict or not and to do so without throwing KeyError's.
  • There's also dictionary comprehensions. Comprehensions have their place and can make code more concise and cleaner. Here's a double dict & list comprehension that would, equivalently, require 5 lines and 3 temp variables.

"""Converts "a=10,b=20" into {'a': 10, 'b': 20} dictionary"""
{k:int(v) for k,v in [_.split('=') for _ in "a=10,b=20".split(',')]}

  • Oddly, your use of "{'in': 'quotes'}" is, in fact, a dictionary comprehension... It is magic syntax, just like "[list comprehensions]" that you complain about. Same thing. The irony is interesting.
  • You realize that keys of dictionaries don't have to be strings (can be anything hashable)? You have to put quotes there because you want the key to be 'in' rather than throw a SyntaxError because in is Python syntax. What would you want foo['bar'] to result if foo had no 'bar' in it? Return None? What if foo had a key in it 'bar' and that its value was None? Now you've confused two very different results (this sounds like JavaScript). If you wan this, then do foo.get('bar', None) and you're happy. The behavior is defined.
  • There's a vast difference between a dictionary key and an object attribute. dict.get() and getattr() should not remotely be confused. See above comments about the data model.

I think your grievances with Python will dissolve with better understanding of Python itself. Expose yourself to Python beyond Django...

@patmoore

This comment has been minimized.

Copy link

@patmoore patmoore commented Oct 12, 2019

Indentation as a way to indicate blocks.

Copy and pasting code is a thing.

Copy and paste this code:

if foo:
x = y+foo
if x > 4:
foo =3

Was the original block:

if foo:
    x = y+foo
if x > 4:
    foo =3

OR?

if foo:
    x = y+foo
    if x > 4:
       foo =3

What happens if the editor 'helpfully' fixes things to one of those 2 choices? and it picks the wrong formatting. A big enough block of code, enough of a hurry and it will not be caught.

Refactoring: moving a block of code to a new method... on and on - a common operation now becomes a err-prone operation.

Keep in mind that the editor being used is not necessarily a IDE. It could be a word document that is being used to write a thesis. Every other language has { } or equivalent that allows the reader to correct bad formatting. Even bash(!) has if/fi and do/done delimiters, to allow recovery from a bad reformatting.

Someone in the python community needs to step up and have a path forward to allow for block boundaries to be marked without relying on white space

@jeffehobbs

This comment has been minimized.

Copy link

@jeffehobbs jeffehobbs commented Oct 12, 2019

This reads like a list of complaints about Django.

@edwardbeckett

This comment has been minimized.

Copy link

@edwardbeckett edwardbeckett commented Oct 13, 2019

I stopped learning Py as soon as I realized white space was part of the syntax.

@hecvd

This comment has been minimized.

Copy link

@hecvd hecvd commented Oct 13, 2019

You can use tabs if you prefer, Ed.

@XVicarious

This comment has been minimized.

Copy link

@XVicarious XVicarious commented Oct 13, 2019

Try mathialo/bython.

@karnikamit

This comment has been minimized.

Copy link

@karnikamit karnikamit commented Oct 13, 2019

"I think your grievances with Python will dissolve with better understanding of Python itself. Expose yourself to Python beyond Django..."
+1

@girng

This comment has been minimized.

Copy link

@girng girng commented Oct 13, 2019

Lol, I love how this is flagged on HN 🤣

@1oglop1

This comment has been minimized.

Copy link

@1oglop1 1oglop1 commented Oct 13, 2019

but then its syntax turns everything into a mess

Now look at JavaScript where deprecation does not exist and you can define a function in 4 or more styles and each does something else.

@leoburgy

This comment has been minimized.

Copy link

@leoburgy leoburgy commented Oct 14, 2019

If you prefer not to use "superfluous" quotation marks in dictionary keys, you can also use the syntax dict(foo="bar").

@Aimage

This comment has been minimized.

Copy link

@Aimage Aimage commented Oct 14, 2019

It's true that you have to remember too many variable in python. But look at this on JavaScript
x === undefined

VM4312:1 Uncaught ReferenceError: x is not defined
at :1:1

Finally what does mean undefined ?

@roniemartinez

This comment has been minimized.

Copy link

@roniemartinez roniemartinez commented Oct 14, 2019

This is more like complaints because you have very different expectations. I've been into Perl, C++, Java, Javascript and it is only Python that made me stay longer (Senior Specialist). Of course I still do Javascript for client-side coz we have no other better choice for that.

@easbarbosa

This comment has been minimized.

Copy link

@easbarbosa easbarbosa commented Oct 14, 2019

Nested parens is a good thing. Always! :D

@imneonizer

This comment has been minimized.

Copy link

@imneonizer imneonizer commented Oct 15, 2019

Seriously would you really like to have {{{{{}}}}}} these kinda confusing opening and closing..... Hell only for these reasons i quit java and c++, if you learned a bit about python then you know how to efficiently use white spaces, you just need a good editor unless you know how indentation works i can even write that into notepads.
Talking about list comprehension
Whats wrong in writing
foo = [x for x in numbers if numbers < 10]
Learn some basics bro, django is confusing i can understand use flask its much easier get a taste of it before complaining about it.

@ZuluPro

This comment has been minimized.

Copy link

@ZuluPro ZuluPro commented Oct 15, 2019

Don' feed the troll ...

@glenfant

This comment has been minimized.

Copy link

@glenfant glenfant commented Oct 15, 2019

I only agree with the last point (about pipfiles that are obscure to me too).
Seriously, the other points are either trolls or jokes, or mean you only learned the surface of Python (confusing attributes and dict keys, etc...)

@greypanda

This comment has been minimized.

Copy link

@greypanda greypanda commented Oct 15, 2019

So you prefer requirements.txt over Pipfile? I was so happy to see pipenv that I had a book-burning.

@ghsolo1

This comment has been minimized.

Copy link

@ghsolo1 ghsolo1 commented Oct 16, 2019

This is a Click bite title. Here is my opinionated view of Python ;-)
Python is "the simple and the most powerful language" humans have invented in terms of Features and community behind it on the planet despite of not being the key language driving the internet. To complain about Python, one has to be either Guido or must be a decade user of Python. Though Python started as a one man's mind now it is the mind of humanity.

@rubik

This comment has been minimized.

Copy link

@rubik rubik commented Oct 16, 2019

Before complaining first learn Python to a minimal level. You clearly come from Javascript and it seems you have just skimmed the language. All the negative points you listed don't make any sense, except for the packaging one. That's still a bit messy on Python.

@RagAlMuffin

This comment has been minimized.

Copy link

@RagAlMuffin RagAlMuffin commented Oct 16, 2019

Argh !! I was deceived, I thought it was an elaborate discussion on the limitations of Python. Instead, it is a list of complaints without any further explanation... I have been learning Python for more than ten years now and it is the only programming language I've remained with. So I was hoping this discussion would implicate different languages (C, C++, Perl, Ruby, Julia, Java, JS, etc..) with people confronting their view about an ideal programming language. As for me, I believe Python is the greatest language for all-rounders. I like how it is accessible yet allows to go far in possibilities. I believe the space/tab indent forces you to make the code readable just by peeking on it. I love how the comprehensions makes it both efficient and readable and I really like the f strings ! Of course, I would not recommend Python as a first choice if you want to design an OS, or if you are programming a CFD code or an android application but in the end, it's a great day-to-day language for many things.

@Aimage

This comment has been minimized.

Copy link

@Aimage Aimage commented Oct 16, 2019

So we end up comparing languages to Python. Every languages is a tool and every tool has its own pros and cons.
As main pros for python I can say simplicity, readbility and cover many filed (web, desktop, embeded with micropython, ...)
As cons I can say performance compared to C or C++.
I don't think all you mention before are limations of python, they are python nature and how it does stuff. You have to deal with them if you want to build something with python.
It's like we want to live in china and need to speak chinese but we don't like their alphabet cause their is no latin character.

@juanfal

This comment has been minimized.

Copy link

@juanfal juanfal commented Oct 16, 2019

Python has been my last language to learn. The hype about Python comes from the spaces other languages have left. Particularly Java and its verbose, inconsistency, old style and rigid syntax and strict OOP for everything. Ruby, being a much beautiful, consistent, and natural language has the absurd drawback of not being European or American and its support written in Japanese. That made its development (libraries included) much slower.

Last version of Python is concerned about := (as if it were something revolutionary!) but leaves its many absurdities without any perspective of solution.

@Antu7

This comment has been minimized.

Copy link

@Antu7 Antu7 commented Oct 19, 2019

Exactly Python is not a great programming language for trolling

@kissgyorgy

This comment has been minimized.

Copy link

@kissgyorgy kissgyorgy commented Oct 19, 2019

Half of this list is just simply stupid, half of it is nothing to do with Python itself (but the Python ecosystem), you don't know the difference between a dict and an object, so I suggest you don't use Python at all and don't write stupid things about it.

@greypanda

This comment has been minimized.

Copy link

@greypanda greypanda commented Oct 19, 2019

You cannot get by today as a one-trick pony. If you do any embedded devices, you will need C/C++ ( Although MicroPython is promising. ). Javascript for browsers. ( I hate it, but love browser based apps. ) PHP to repair bad web apps that you don't want to re-write. ( I hate it, but wrote a lot of apps when it was the only thing around. ) Python to string it all together. ( Love, hate. ) Java is so convoluted I won't even touch it anymore; I had to learn Java to keep my job. Perl is just a memory, but I still see some diehards.

I consider myself fairly fluent in all of these languages but I use the ones that get the job done. I'm just experimenting with Rust and Go, but every language has the good and the bad. Just enjoy the challenge.

@abbyrjones72

This comment has been minimized.

Copy link

@abbyrjones72 abbyrjones72 commented Oct 19, 2019

Languages are what you make with them, not the languages themselves.

@greypanda

This comment has been minimized.

Copy link

@greypanda greypanda commented Oct 19, 2019

Languages are what you make with them, not the languages themselves.

Exactly. You can't expect to be a decent French speaker with one class in high-school French.

@Murithijoshua

This comment has been minimized.

Copy link

@Murithijoshua Murithijoshua commented Oct 20, 2019

well each language has its up and downs.We are deep diving into Agile software development,Instagram lies on Python backbones @abbyjones72 i second you.

@Endzel

This comment has been minimized.

Copy link

@Endzel Endzel commented Oct 20, 2019

In my honest opinion, Python is just pushing the boundaries of abstraction for programming languages to the highest level. Readability comes at the cost of efficiency, where sometimes it does not matter enough. And in general, making things simpler is a really honest objective.

Of course it has downsides and you pretty much summed up a lot of them! Now, the ball is on our roof to work for the future developments in order to avoid this kind of mistakes as much as possible.

@nasoma

This comment has been minimized.

Copy link

@nasoma nasoma commented Oct 21, 2019

Yet another example of a Javascript guy who wants Python to be Javascript.

@archivedaccount

This comment has been minimized.

Copy link

@archivedaccount archivedaccount commented Oct 21, 2019

global interpreter lock is hell

@jreniel

This comment has been minimized.

Copy link

@jreniel jreniel commented Oct 22, 2019

global interpreter lock is hell

I second this. The GIL and the implicit memory management are the two main things I'd vote to improve in Python, and ironically, neither is mentioned here. Other than this, I don't think some of the complaints listed here make much sense. It doesn't seem like the author really understand Python.

@jasongodev

This comment has been minimized.

Copy link

@jasongodev jasongodev commented Oct 22, 2019

PHP is still the best and straightforward way for web programming. I wished PHP was able to develop its statistical libraries and routines so that it will be easier to do inferential statistics, machine learning, etc. Python and R are very unexpressive when it comes to syntax. They just sound less natural like Pascal.

@sonhanguyen

This comment has been minimized.

Copy link

@sonhanguyen sonhanguyen commented Jun 23, 2020

Yeah I don't know why javascript gets all the bad rap, while python is just as guilty if not more. Modern javascript with typescript on top is still less complex than python 3. List comprehension is so overrated. I get comprehension in scala, it's actually a functional programming thing. Comprehension in python is just a stylistic thing that in practice you can't always use. So you end up flip-flopping between it and map/reduce and some dot notation api (which sucks because of python line breaking rules). So much for the "zen of python".

@juanfal

This comment has been minimized.

Copy link

@juanfal juanfal commented Jun 23, 2020

@contactkkiran

This comment has been minimized.

Copy link

@contactkkiran contactkkiran commented Jul 26, 2020

Yet another example of a Javascript guy who wants Python to be Javascript.

@ax-iomata

This comment has been minimized.

Copy link

@ax-iomata ax-iomata commented Sep 26, 2020

Defenses of python: "But if you write it in this other one of a million idiosyncratic ways...." "But it has lots of code written for it already..." "But if you knew the ingredients of the secret sauce behind the opaqueness..." "But if you had a third-party tool that does what's not part of the language itself..." "They just extended the language for the umpteenth time with another tack on bit of syntactial flourish that does that more clearly..."

It's so expressive as to become idiosyncratic and mutually unintelligible. It's so fragile as to require para-linguistic tools to keeo anything but a tiny program from shattering after hours or days of running. Between 2 and 3 it's internally inconsistent in some ways. It's taught to everyone and becomes the first and last language they learn. It contains an excessively high degree of magic syntax relative to other languages. It's epicycles upon epicycles of syntax. It's defenders offer paper tigers and thought-stoppers that fall apart under basic critical thought. It's the sunk cost fallacy. It's the favorite of people who only know one word of programming: "python."

There's a solution for every problem that python manifests, the problem is the sheer number of problems it manifests. It's the perfect playground for know-it-all geeks that can decry those who see its problems as simply "not knowing enough about it." Even its problems are idiosyncratic. It's the formal equivalent of a highly irregular natural language.

I've never met a language theorist that likes it.

@RobertAKARobin

This comment has been minimized.

Copy link
Owner Author

@RobertAKARobin RobertAKARobin commented Sep 26, 2020

My theory is most Python fans come from backgrounds in Java, a C variant, or some other "hard" language. Naturally Python is a breath of fresh air in comparison, and keeps a pretense of being serious, science-y, and academic unlike other "easy" languages like JavaScript and Ruby.

@ax-iomata

This comment has been minimized.

Copy link

@ax-iomata ax-iomata commented Sep 26, 2020

I came from a background of self-taught C++11 (which wasn't hard) and python made me very uncomfortable. On the other hand, being taught OCaml at school felt like a breath of fresh air. To this day I'm perplexed as to why functional languages leave people perplexed. It's like listening to a formally trained pianist decry the Janko design because they have to learn a new way of moving their fingers in order to save themselves 12/13 the effort of playing a song.

@Mr-Jonas

This comment has been minimized.

Copy link

@Mr-Jonas Mr-Jonas commented Oct 1, 2020

Self.I lost all respect for python after i mailed myself a program and at home,
Self.it no longer ran as it should due to the idiotic idea that white space matters for program flow control.
Self.Feels like a toy language but very nice for scripting.
Self.Also, the need to write Self all over, makes OOP feel like an afterthought.
Self.Pretty annoying for math classes
Self.Where you want to use member Self.variables Self.in Self.formulas and have to use self in front of all of them. Plain ugly.
Self.And no forced access control. Using _ to mean private is just a very amateurs way of
Self.handling language design but I guess for some reason, he didn't want real encapsulation.
Self.But then again. The only languages that nobody complains about, is the ones nobody uses :)

@KerimG

This comment has been minimized.

Copy link

@KerimG KerimG commented Jan 3, 2021

I want to love Python too and I still occasionally recommend it to beginners but honestly? It's a horrible beginner's language

  1. __this_is_hella_ugly__ and actually makes code less readable for beginners, this is especially true when doing OOP with private members
  2. whitespace in the syntax means copy-pasting Python is error prone, especially true when mailing or pasting it in a chat or something to get advice from someone
  3. pip is worse than npm even. It has all the bad trivial packages npm has but installs everything in a "global" manner, which makes dependency management a PITA. Also it makes it more difficult for beginners, because now their installed module isn't just residing in the folder of their project but it's somewhere on the system. They put their project on a USB, take it home, and try to run it on their computer only to find out it doesn't work
  4. Try explaining why the Python 2 example they found doesn't work in their Python 3 interpreter to a beginner

From a beginner's perspective, there's no benefit to starting with Python over even C. At least with JavaScript, you can immediately start developing in the browser and make graphical elements move. That seems to be way more rewarding and exciting to people at the beginning than implementing the Sieve of Eratosthenes in a terminal window, even though the latter is a bigger accomplishment.

Since it's a crappy language for beginners and becomes unwieldy in bigger projects, I believe that Python is true scripting language. It's perfect for single file scripts that, at most, act as a wrapper for some C-libraries.

@notjames

This comment has been minimized.

Copy link

@notjames notjames commented Feb 18, 2021

I love this thread. It's obvious that there are passionate people on both sides of the argument. Moreover, the python lovers are, like any other passionate human beings, capable of rationalizing the "good" of the language. Put me in the "I hate python" camp. I'll try to be as rational and dispassionate as I can, but every time I have to code in python, I find some ridiculous inconsistency about it that I end up just passionately hating the language even more. At any rate, I'm in such a bind right now. BTW, FTR, django sucks, too, but it's hard not to suck when you are written in a sucky language. A few top-level thoughts...

  1. forced white space indentation - it's like having a communist government forcing "greatness" for the good of the masses only to realize that the government never does anything right and it's always better to allow people to do their own thing. If people make something that sucks, that product doesn't succeed ultimately, and they either have to make it again, make it better, or it someone else comes in and makes a better alternative. Sure, some people love the communist way, but let's admit it, it's probably because of laziness. OTH, people should not abuse the freedoms they are given (non-forced whitespace indentation). Where is the happy medium?! I'd rather have the freedom to do my own thing than be forced to do it by someone else's standards. I've never had to read relevant code by anyone where whitespace was the cause of my inability to understand what I was reading. That's just me; I'm not saying it doesn't exist, but I am suggesting that it's such not a huge problem in the world that forcing people to use specific whitespace indentation should be warranted. ¯_(ツ)_/¯ - meh
  2. I absolutely abhor the lack of consistency between OOP and functional use of base methods/functions in python. This problem stems, I imagine, from an inconsistent paradigm at the core of the language. For instance, Ruby was written strictly as an object oriented language. It's not a perfect language, but it's by far more consistent than Python is in my estimation. IE len(list) vs list.length(). One has to memorize inconsistent ways of doing things, which is just unnecessary tech debt.
  3. I am fine with list comprehensions. In fact, part of me thinks they're kinda cool, but if you think about it, for a language that touts "easy to learn" and there is only "one way to do it," list comprehensions seem to break that paradigm. In fact, I've heard many a developer argue in favor of python vs languages like Ruby and Perl using this exact argument. Perl is too hard to read because TMTOWTDI, but aren't list comprehensions exactly that?
  4. The nuances of creating packages/modules are annoying. In theory, it's easy. Fortunately, this is not just a python thing, but I'm dealing with this pain point now, so I'll mention it.
  5. Anytime someone has to go and read a butt-ton of manifestos to understand why or how python works is prima-facie evidence to me that something isn't right about the language. Nevertheless, I find more and more, when someone raises questions or concerns about something, they're told to read the PEP. I mean, I get it. You can't please 100% of the people 100% of the time.

I've decided that, like so many other computer-related holy wars, these arguments are subjective and I'm really just venting here. I mean, here I am coding something in python and grumbling about some of the things I hate about the language finding myself wanting to lament with others. Frankly, there's really not much someone can say that can change my mind. I know many languages. This one is one I just hate in comparison to the others that I know. I prefer Ruby the most. It's my favorite language. And the funny thing is the minute someone reads this, they will stop reading this rant after forming some opinion of how I must not know what I'm talking about. And that's fair. Everyone is entitled to their opinions. For that one reader, there are 50 others in agreement with me. Conversely, there are 50 others in agreement with that reader. Meh, whatever. All of that said, I absolutely, unequivocally, unabashedly, and in all other ways....hate python. It's a language that gets way more hype than it should get. It has some good qualities, but there are 10 other way, way, way better languages out there. I don't understand why python gets as much love as it gets.

@grahamnicholls

This comment has been minimized.

Copy link

@grahamnicholls grahamnicholls commented Feb 24, 2021

My heart sinks every time I'm forced to use Python. In the end, it amounts to : "it's ugly, arrogant (4 spaces, anyone - thanks, but I'll stick to tabs and set ts=2 sw=2 in vi), horribly verbose, but above all, it's prone to people writing unreadable code - just like Perl. Flame all you like, but I have 35+ years programming experience, and have been paid to program in 10+ languages as well as been competent in many more. This article is not a troll, and for those claiming it is, run back to mummy. For comparison, I love golang, Ruby, Lua, and for gluing things together, bash. Golang is just perfect for me. Small, simple, fast, powerful. The anti-Python!

PS Try reading version 3.8 of the article - the author loves Python in that version. Sorry that it's not backwards compatible.

@grahamnicholls

This comment has been minimized.

Copy link

@grahamnicholls grahamnicholls commented Feb 24, 2021

I love this thread. It's obvious that there are passionate people on both sides of the argument. Moreover, the python lovers are, like any other passionate human beings, capable of rationalizing the "good" of the language. Put me in the "I hate python" camp. I'll try to be as rational and dispassionate as I can, but every time I have to code in python, I find some ridiculous inconsistency about it that I end up just passionately hating the language even more. At any rate, I'm in such a bind right now. BTW, FTR, django sucks, too, but it's hard not to suck when you are written in a sucky language. A few top-level thoughts...
...

I was too lazy to type more than I did in an earlier comment. I couldn't agree more with your argument, especially wrt list comprehension. It seems such a shame to me that Ruby's star is on the wane, whilst the mess of Python is so popular. Why, for the love of God, WHY?

@RobertAKARobin

This comment has been minimized.

Copy link
Owner Author

@RobertAKARobin RobertAKARobin commented Feb 24, 2021

After an additional year-and-a-half of writing Python, I've decided to revise this article

@grahamnicholls

This comment has been minimized.

Copy link

@grahamnicholls grahamnicholls commented Feb 24, 2021

How prescient of me - version 3.8 coming. Written in ancient runic egyptian, but the author now loves Python. What do you mean, you don't read ancient runic egyptian - it's progress, and you should see the new pyramid constructor - it's great! Oh, and if you install using rosettaenv, you can read the old-style article on the same computer as Article v3.8. Simple. By the way, there's a new way of printing in the new version. You can have 23 ways to interpolate strings, but still no switch statement - that's f{syntactic sugar|not Pythonic}. Ugh, what a diabolical mess.

@juanfal

This comment has been minimized.

Copy link

@juanfal juanfal commented Feb 25, 2021

Python, compared with Ruby is, let me say poor. Boring, and whimsical. Full of absurd and never agreed for everybody syntactical limitations. Python is inconsistent. It doesn't respect what many years of UNIX mature use have shown and everybody agrees with, quotes and double quotes equivalence is an erroneous waste of syntax. I don't understand why the need of it. Please don't answer here that it is for nesting one type of quotes inside the other, my gosh. The many syntactical limitations like assignation made function finally added at 3.9 show it has been devised by a whimsical person. The horrible second class citizen regular expressions makes them almost unused by anybody. In Ruby/Perl regular expressions are so easy to use, ruby has for example string[/something/] directly!

Python is simply: dictatorship of the majority

@rai-gaurav

This comment has been minimized.

Copy link

@rai-gaurav rai-gaurav commented Mar 3, 2021

Perl to Python - You have become the very thing you swore to destroy.

  1. Multiple ways to interpolate string and it says there is only one way. Clearly Perl TMTOWTDI principle.
  2. Perl code are more readable than list comprehensions. :P. And they call Perl line nose language.
  3. Perl has anonymous subroutines since ages. Python has just given it the shining name 'lambdas'. Yet, a typical python developer boast about it like its some revolutionary thing.
  4. Closures - Look at this article. Its from 2002 . yes, even before 2002 Perl has it. For a new python guy, its again a revolutionary thing.
  5. Don't get me started on Decorator and Generators.
  6. regex meh!!!!. PCRE is industry standard.
  7. Look at there horrible scoping names (nonlocal ?).
  8. Why on earth I have to write if __name__ == "__main__ ?
  9. Backward compatibility ? I don't know what you are talking about
  10. I found newcomers who learn Python as first language, they have hard time adopting to any language. According to them python is best for everything.
@bratwiz

This comment has been minimized.

Copy link

@bratwiz bratwiz commented Mar 13, 2021

I've decided that I really don't like Python. After years of resisting learning it, I thought I'd give it a serious, earnest go.... I so totally agree with the commenter above, Perl to Python-- what was it you were saying again?? I'm going to stick with it some more, because it does look interesting for some very simple things. But, IMO, it's a language that has no natural grace and never will.

@lampuiho

This comment has been minimized.

Copy link

@lampuiho lampuiho commented Mar 29, 2021

I find myself always going back to matlab for all the maths I need to prototype, mainly for the convenience of indexing. If I am gonna do some stuff that needs more speed or better with OOP, I do it in C#/C++. I just prefer a strongly typed language.

@xennex22

This comment has been minimized.

Copy link

@xennex22 xennex22 commented Apr 22, 2021

I believe the author has skipped some biggies:

  • Global interpreter lock. Enough said.
  • Versions. Does the customer have 2.7 or 3.5 or 3.7 and where are they? Let's just install another known good version in another location and update the path to make sure.
  • Import. What are I importing, where is it, and (unique to Python) what parts of it am I importing?
  • Objects. Seems to be worse than an afterthought.
  • Garbage collection. Great, my program stops every 2 seconds for 70 ms.
  • Dogma. There a dogma with Python which cannot be questioned which gives it a cult like following. But not nice like Rust. Some examples would be readability and memory safety below.
  • Readability. The dogma says that Python is more readable like a strongly typed language. But in practice when I am looking through code and see 'def function(param1, param2, param3, param4)' there is no way of knowing what type the parameters are without looking at the code. Sure, the function should be commented and the parameters given sensible names, but in practice a lot are not. In a typed language at least the function definition tells you.
  • Memory safety. The dogma says that 'unsafe' languages like C are dangerous and you are going to do all sorts of bad things. But the one study that looked at program reliability did not find any difference between C and Python. And tell me if a run time exception is better or worse than the compiler telling you something is wrong.
@DrewDrewBarney

This comment has been minimized.

Copy link

@DrewDrewBarney DrewDrewBarney commented Apr 30, 2021

Python will be an ugly dead-end in the history of programming languages and I wish Guido had done something useful during his recess. It pains me that it is popular with academics because of its initial ease of learning. It provides a learning base which is detrimental to the acquisition of other properly structured and typed languages. It saddens me that so much effort has been put into package development which could have been done in a more appropriate language. It sacrifices too much for so called "readability" but this is easily achieved within an editor with conventional block structured language if one so chose. I could for example make my editor display C code in a form identical to a Python indented block. To do so is trivial. The cost of relying on whitespace and formatting is not.

@bratwiz

This comment has been minimized.

Copy link

@bratwiz bratwiz commented Apr 30, 2021

@GrahamJoonsar

This comment has been minimized.

Copy link

@GrahamJoonsar GrahamJoonsar commented May 3, 2021

Python is good for learning at first, but beginners should try to quickly transition to a typical programming language.

@jasongodev

This comment has been minimized.

Copy link

@jasongodev jasongodev commented May 4, 2021

The future of backend development is in the edge computing.
The future of app development is the fusion of mobile and desktop apps - write once, deploy in any device.
The future of web development is in the frontend - static files with scripts and WebAssembly.
The future of scientific computing is on faster code execution that can be done even in the edge - natively compiled code is needed.
The future of transportation is on AI that is super fast to run on embedded systems.
In all these futures, Python is LEAST likely a candidate.

@gregory-smith-nih

This comment has been minimized.

Copy link

@gregory-smith-nih gregory-smith-nih commented May 7, 2021

I see a lot of 'you don't understand Python' replies. THAT IS the problem. You should not have to be 'deep in the plak tow' to fully grok a computing language. A good general purpose computing language will have a few basic concepts that are easy to understand and learn, and can be expanded to solve a variety of problems.

The OP has demonstrated that Python fails that test. Other comments that "You're not a Python Expert" implies that to program in Python effectively you must be an expert.

This implies that it is not an easy language to learn, understand, and modify - which makes it a poor language.

@greypanda

This comment has been minimized.

Copy link

@greypanda greypanda commented May 7, 2021

Well, if you can't understand basic Python, good luck on most other languages. I have used a couple of dozen languages in my career, and the bulk of them have a "C"-like structure and few are more friendly than Python. Add a decent IDE like VSCode or Atom, and most of the work involves thinking, not typing.

@DrewDrewBarney

This comment has been minimized.

Copy link

@DrewDrewBarney DrewDrewBarney commented May 10, 2021

Hi greypanda. "Well if you can't understand...". That old one. Undermine the person not the opinion. I come from a Pascal, C, C++, Objective C, Java and PHP background. While I recognise that Python is powerful and extensible with a host of very useful libraries (I use some of the statistical ones) it has some fundamental structural problems. The reliance upon block indentation is eccentric and creates problems when cutting and pasting. My subjective opinion is that is less clear. There is no way, at the end of a long block, to know the level of block nesting (other than assistance from the editor, on which I should not need to rely). I believe that by language design only symbols and not whitespace should have meaning (the Java package model irks me for the same reason). Duck typing is a quick fix for beginners and rapidly becomes a serious problem on more complex projects. I would rather have a compiler error than a runtime error and no degree of run-time testing will ever provide sufficient assurance on complex projects, the problem space is simply too large to search because of combinatorial expansion. There are some really ugly features of Python that show a lack of diligence in its design from the start. Lack of block scope. Implicit handling of call by copy or reference based on type. Static class members accessed from object instances. This list of fundamental design flaws is not comprehensive. This is an accessible language for beginners and non-specialists which is a good thing. The problem is that many people (academics, data scientists etc...) have clung on to it rather than transitioning to a more reliable language and it has developed beyond its design limitations. The outputs they produce are quite likely to be flawed.

@ruffianeo

This comment has been minimized.

Copy link

@ruffianeo ruffianeo commented May 12, 2021

Though Python started as a one man's mind now it is

This summarizes the problems I have with python best: They think they found something. 200x slower than any other language? "its cool dude we have FFI". Any other language which is not as slow as a snail also has FFI. Python is like a self fulfilling prophecy with fanatic clerics spreading the gospel. I prefer the at least factor 50 faster Common Lisp any day of the week.

@rsagarrokade

This comment has been minimized.

Copy link

@rsagarrokade rsagarrokade commented May 24, 2021

This is a very nice one and gives in-depth information. I am really happy with the quality and presentation of the article.
Python classes in Nashik
Python course in Nashik
Python training in Nashik

@lautiamkok

This comment has been minimized.

Copy link

@lautiamkok lautiamkok commented May 25, 2021

Whether Python is good or not, it doesn't matter much. It's the Python community. After years I still cannot find my passion and love in Python, just because of the bad culture in the Python community, just as the OP pointed out.

Twenty more years ago when I started to learn Python, then I walked away, just because of the arrogance and superiority mentality in the Python community. Until today, I still cannot invest in it because of the same mentality in the Pythonists.

A language shapes us. If it can't teach us to be humble, I cannot fall in love with that language.

@greypanda

This comment has been minimized.

Copy link

@greypanda greypanda commented May 25, 2021

I don't believe the Python community is any worse than others I have encountered. Java was one of the worst. I started out asking some simple but important questions in the early days and the only response was "just ignore the noob, he's not worthy of your time". PHP was not much better -- "well, you are not running the latest version, so why should I help you?" And the C/C++ community was a real elitist group.

But I still use those languages when the need arises. When applying for a job, I don't wear a particular color of programming hat, I use whatever the customer has, not what I "love". Python is usually my choice for structuring a new project, but I use the platform that fits the problem for the final product.

@gregory-smith-nih

This comment has been minimized.

Copy link

@gregory-smith-nih gregory-smith-nih commented May 25, 2021

I have to echo @greypands's comments. I find all the different programming communities to be arrogant as a group. I don't pick a language it's usually picked for me by clients. All of the language 'gurus' argue "you just don't understand {{language}} - you have to become an expert.

You shouldn't have to be an expert to be effective in a programming language. Programming languages are to make programming computers easier for people - not the other way around.

But this thread is about the quality of Python and its warts. All languages have warts. JavaScript is terrible - except where it's great. And JavaScript is my language of choice these days after 20 years of Java programming. Mainly because the 'friction' to getting started on a new project is so low... but make no mistake - JavaScript is terrible. Just as BASIC and later VisualBasic were terrible.

Python is terrible. But I still use it.

@RobertAKARobin

This comment has been minimized.

Copy link
Owner Author

@RobertAKARobin RobertAKARobin commented May 25, 2021

I would say one difference is that JavaScript developers freely acknowledge that it's terrible, in my experience.

@greypanda

This comment has been minimized.

Copy link

@greypanda greypanda commented May 26, 2021

After some introspection, I see that most of my gripes with Python are the same ones I experience with other languages. Dependencies drive me crazy, and libraries that try to solve every problem at once make life hard.

@ruffianeo

This comment has been minimized.

Copy link

@ruffianeo ruffianeo commented Jun 6, 2021

After some introspection, I see that most of my gripes with Python are the same ones I experience with other languages. Dependencies drive me crazy, and libraries that try to solve every problem at once make life hard.

And once again I hold the torch for Common Lisp. Why? Because the base set of functionality in the standard (without other packages or dependencies) is powerful enough to get something done without messing with dependencies.
For a while I was looking into Julia (which is great in its own ways (and much faster than Python, of course)), but I stopped using it after spending 2.5 full working days trying to get all the libraries and packages and whatnot dependencies together to be able to run a "small" AI framework example. After those 2.5 days of pure pain and endless "oh there is another package I need, and it is documented in a paper...", I had actually forgotten, what I wanted to do when I started.
Then, I found a problem with the standard DateTime functionality in Julia (was not ISO 8601 compatible) and wrote an issue, only to get the response that I should not use the core type for that but some library (which also messed up with the fractions of seconds part of the time), only to be told then that I should write my own package (which would then be package number 3 for the same thing).

I know I am pretty alone in my opinion, that "thousands of packages" is actually not a blessing but a warning sign to stay clear from technology, advertising with this argument.

@davitomasi

This comment has been minimized.

Copy link

@davitomasi davitomasi commented Jun 6, 2021

Thanks for sharing this information. clinica de recuperação

@gregory-smith-nih

This comment has been minimized.

Copy link

@gregory-smith-nih gregory-smith-nih commented Jun 7, 2021

And once again I hold the torch for Common Lisp

I hear you. I learned Lisp in the early 80s and all modern languages either borrow from it, emulate it, or unwittingly duplicate it. The problem with Lisp is that it's hard to learn and harder to master. Lousy, Insipid, Stupid, Parentheses - is what we called it in college.

@Longwater1234

This comment has been minimized.

Copy link

@Longwater1234 Longwater1234 commented Jun 13, 2021

One major reason i hate Python: the fact that white-space is FORCED as part of the syntax. That’s enough for me.

@bratwiz

This comment has been minimized.

Copy link

@bratwiz bratwiz commented Jun 13, 2021

@grahamnicholls

This comment has been minimized.

Copy link

@grahamnicholls grahamnicholls commented Jun 13, 2021

@bratwiz

This comment has been minimized.

Copy link

@bratwiz bratwiz commented Jun 13, 2021

@davitomasi

This comment has been minimized.

Copy link

@davitomasi davitomasi commented Jun 23, 2021

assessoria de casamento Nice work team, great progress!

@davitomasi

This comment has been minimized.

Copy link

@davitomasi davitomasi commented Jun 23, 2021

aluguel de computadores Thanks for sharing this information.

@Eratosthenes

This comment has been minimized.

Copy link

@Eratosthenes Eratosthenes commented Jun 24, 2021

I love Python as a language for quickly getting stuff built in a clear and readable manner. What eventually drove me away from it was performance--when I needed my code to run concurrently, the multithreading wasn't there. Also, while Python is easy to write, it's also too easy to introduce runtime errors. I now prefer Go.

@ZehMatt

This comment has been minimized.

Copy link

@ZehMatt ZehMatt commented Jul 2, 2021

I actually hate Python because its for the wrong reasons quite popular, its quite good to quickly do something but why does everything nowadays have to integrate Python instead of a language that would make way more sense? Especially in the ML field I wish there would be less Python and more mature languages, Rust, Go, C#, JavaScript, heck I would even prefer Lua over it, yes there are some libraries not using Python but the majority unfortunately does, the amount of time I would have been able to save if it were any other language is no laughing matter anymore. Been developing software for nearly 20 years now and Python is the one thing that makes no sense to me.

@bratwiz

This comment has been minimized.

Copy link

@bratwiz bratwiz commented Jul 2, 2021

@edwhiting

This comment has been minimized.

Copy link

@edwhiting edwhiting commented Jul 10, 2021

In Python, the use of the colon (:) is inconsistent. It can be used to indicate a variable's type or as the equivalent of an opening curly brace ({) at the start of block of code. Because of this, the return type of a function must be specified with an arrow (->) instead of a colon because the colon has already been used.
eg:

class MyClass:
    def add_nums(self, lhs: int, rhs: int) -> int:
        result: int = lhs + rhs
        return result
@GF-Huang

This comment has been minimized.

Copy link

@GF-Huang GF-Huang commented Jul 11, 2021

Stupid syntax design. Which easy for read and typing? Always the second.

map(lambda x: f'number: {x}', filter(lambda x: x > 2, sorted('3,2,1'.split(','))))
'3,2,1'.split(',').sorted().filter(lambda x: x > 2).map(lambda x: f'number: {x}')

People who have never eaten cakes even think shit is delicious.

@notjames

This comment has been minimized.

Copy link

@notjames notjames commented Jul 12, 2021

Stupid syntax design. Which easy for read and typing? Always the second.

map(lambda x: f'number: {x}', filter(lambda x: x > 2, sorted('3,2,1'.split(','))))
'3,2,1'.split(',').sorted().filter(lambda x: x > 2).map(lambda x: f'number: {x}')

People who have never eaten cakes even think shit is delicious.

YES! YES! YES! But this plays into my earlier gripe that python is so bloody inconsistent in its coding paradigm. Frankly that is the top reason why I hate hate hate Python. That problem alone causes python to be one of the least intuitive languages out there in my book. Next would be the bloody white space requirement.

@ZuluPro

This comment has been minimized.

Copy link

@ZuluPro ZuluPro commented Jul 13, 2021

Stupid syntax design. Which easy for read and typing? Always the second.

map(lambda x: f'number: {x}', filter(lambda x: x > 2, sorted('3,2,1'.split(','))))
'3,2,1'.split(',').sorted().filter(lambda x: x > 2).map(lambda x: f'number: {x}')

People who have never eaten cakes even think shit is delicious.

Why TF would you write that ?

@equt

This comment has been minimized.

Copy link

@equt equt commented Jul 29, 2021

Stupid syntax design. Which easy for read and typing? Always the second.

map(lambda x: f'number: {x}', filter(lambda x: x > 2, sorted('3,2,1'.split(','))))
'3,2,1'.split(',').sorted().filter(lambda x: x > 2).map(lambda x: f'number: {x}')

People who have never eaten cakes even think shit is delicious.

Exactly. You can't get formatters working like

s
  .split(',')
  .sorted()
  .filter(removeSomething)
  .map(transformSomething)
  .reduce(collectSomething)

with Python, and you have to pair the parentheses with the help of editor guidelines.


Also, what about the lambda, hah? This is the most awkward design I've ever seen, both syntactically and semantically.

You can find tons of stack overflow questions on the closure scope capturing, so it's either a problem for all our developers or Python itself.

And what's the purpose of the restriction of the lambda syntax? Lambda means nameless, and never means simple, short, or cheap. They're exactly the same with a named function.

@tworthington

This comment has been minimized.

Copy link

@tworthington tworthington commented Aug 2, 2021

I feel you're being very generous to Python. Guido was a hack developer who learnt nothing from what had gone before. His big idea was "ooh, whitespace makes it look like the pseudocode I see in books. Let's do that.", ignoring the fact that books are carefully typeset, not hammered in at 4am under pressure with whatever random editor is installed on the remote server when you HAVE to patch a newly discovered bug that has brought the service down.

The OOP syntax is just a half-arsed joke that can't decide what its own system is for calling methods on objects, assuming that what you have IS and object, of course. Python is full of entities that are not in fact objects. For example, numbers, and flow-control. Not to mention all those defs just floating about at random.

It is a terrible, terrible language with a core echo-chamber culture that absolutely refuses to accept criticism and in fact takes pride in being criticised because it makes the lousy developers feel vindicated in a perverse Dunning-Kruger Effect way.

@shayneoneill

This comment has been minimized.

Copy link

@shayneoneill shayneoneill commented Aug 2, 2021

lambda is yeah one of the things where python could do better. I still think python should look at adopting rubys method of providing anonymous blocks, as an alternative.

But jesus christ this thread has a lot of folks who really seem to be angry about problems that aren't actually problems.

@shayneoneill

This comment has been minimized.

Copy link

@shayneoneill shayneoneill commented Aug 2, 2021

"Especially in the ML field I wish there would be less Python and more mature languages, Rust, Go, C#, JavaScript"

My dude, Python is a decade older than any of those. In fact for the most part the libraries people are doing a lot of the big data stuff are older than any of those languages (with the possible exception of JS, but JS today isnt the JS of the 1990s) Thats what I dislike about the sudden popularity of python, people not realising its actually a fairly old language thats had a somewhat slow and careful evolution (Though picked up a bit of pace now that the loooong road to Python 3 adoption is finally complete)

@notjames

This comment has been minimized.

Copy link

@notjames notjames commented Aug 2, 2021

I feel you're being very generous to Python. Guido was a hack developer who learnt nothing from what had gone before. His big idea was "ooh, whitespace makes it look like the pseudocode I see in books. Let's do that.", ignoring the fact that books are carefully typeset, not hammered in at 4am under pressure with whatever random editor is installed on the remote server when you HAVE to patch a newly discovered bug that has brought the service down.

The OOP syntax is just a half-arsed joke that can't decide what its own system is for calling methods on objects, assuming that what you have IS and object, of course. Python is full of entities that are not in fact objects. For example, numbers, and flow-control. Not to mention all those defs just floating about at random.

It is a terrible, terrible language with a core echo-chamber culture that absolutely refuses to accept criticism and in fact takes pride in being criticised because it makes the lousy developers feel vindicated in a perverse Dunning-Kruger Effect way.

I wish we could thumbs up comments. This one is one with which I completely agree.

@grahamnicholls

This comment has been minimized.

Copy link

@grahamnicholls grahamnicholls commented Aug 11, 2021

@muratyaman

This comment has been minimized.

Copy link

@muratyaman muratyaman commented Sep 10, 2021

:D ironic to see quite a few comments like:

"you don't know python, maaan"

people are kidding themselves and only deceiving the young programmers about Python!

if a programming language makes me think unnecessarily and reduces my efficiency

(never mind the runtime efficiency! another big topic),

it is not a good one!

no one can defend this:

data = [None] * 100

here is a hard one for Python as it chokes! it is easy in other languages.

class Person:
  def __init__(self, name = '', age = 0, is_fan = False):
    self.name   = name
    self.age    = age
    self.is_fan = is_fan
  # end def

  # without this, method hydrate() does not work;
  # it causes "TypeError: 'Person' object does not support item assignment"
  def __setitem__(self, k, v):
    if k in self.__dict__.keys():
      self[k] = v # FIXME: this causes RecursionError 
    # end if
  # end def

  def __str__(self):
    return str(self.__dict__)
  # end def

  def info(self):
    not_str = '' if self.is_fan else 'not '
    return f'{self.name} is {self.age} years old, and is {not_str}a fan'
  # end def

  def hydrate(self, dictObj):
    for key, value in dictObj.items():
      self[key] = value # this requires magic method __setitem__()
    # end for
  # end def

# end class

p = Person('John Smith', 20, True)
print(p.info())
print(p)

data = {
  'name': 'Jane Smith',
  'age': 21,
  'is_fan': False,
}

print('copying data...')
p.hydrate(data)
print(p.info())

to avoid twitching, I had to use comments to highlight the ends of if/class/for/method blocks!!! ugh!

I know the sophisticated ones will tell me off and show me better ways of doing things

(in reality offering a work around for an absurd unintended side-effect of some features) and say:

learn some python, maaan!

happy coding, everyone!

...using the programming language that you feel comfortable and efficient; the one that makes you love your job, not hate!

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