On many forums, discussions between devs and several blogs, I saw a lots of articles in which Python is mentioned as a bad or ugly language; but why is it so?
I find Python awesome: building everything fast, easy to read and to learn the basis, etc.
But whenever I ask to my fellow developers, nobody gives me a constructive answer; so what is your opinion about it?
Happy coding !
Oldest comments (70)
Seems like programming languages are a lot like religions. And developers can become extremely religious. Whenever I read things like this, X is a bad language, Y is really ugly, I consider it to be a good thing. People only complain about the languages we use. If nobody complains about your language, nobody uses it.
As for the constructive answer, I don't know Python so I can't help you :D
It's like Stroustrup said: “There are only two kinds of languages: the ones people complain about and the ones nobody uses.”
I came upon this quote a few years ago, and this is my absolute favorite in the programming world. Perfection doesn’t exist. We developers make countless arbitrary choices in everything we do, therefore it’s absolutely impossible to please everyone.
Let’s just keep coding!!
Oh Stroustrup. I wrote him an email many years ago. I told Bjarne that a programming language which permits you to obfuscate absolutely anything is not a language. It's gibberish. Funny, I never got a reply :) I really was not trying to be rude. All I wanted to do was to point out that the purpose of language is to create mutually intelligible messages. C++ is a danger to that maxim. In twenty-five years of my involvement in software development, usually within a team, I have found nothing wastes more time and money than bucking convention.
True - the cure for that (like for the real thing) is learning about other languages, seeing your languages problems and realizing that there is no true language and that it's all a big hoax ;)
Programming language hate is often pretty shallow. Python lacks where other languages thrive (like strong typing/compiler) but makes up for it by being simpler to use and read in a lot of cases. It's also widely adopted in many important fields which is a big deal regardless of language bike-shedding.
Some languages also receive a lot of hate from their own community and a lot of that is just venting. People keep chugging along with these tools because they're ultimately useful.
If you find Python awesome, keep up whatever you're doing with it and don't pay much attention to the critics. If you're still curious about the criticisms, try picking up something really different and see if you like those too for different reasons.
Now try that in PHP 😂
If I were going to complain about syntax, I'd start with meaningful white space, which I'm generally opposed to.
In terms of implementation, one could point to the consequences of the global interpreter lock, with regards to threads.
docs.python.org/3/c-api/init.html#...
Python was the first language I learnt, and the first I could consider myself any kind of expert in. I love that it has clearly stated design goals, and that one of them is being readable. The dynamic typing definitely makes it faster to get stuff going, which I think can be crucial for new programmers -- getting that reward for your coding is so important for it to be enjoyable. Other languages can make it feel a lot harder to even get something simple working.
That said, the more I program in languages with static typing and powerful type systems (like Rust), the more appreciation I have for how many bugs can be completely eliminated by these languages. I hate that in Python there is always a possibility that everything will crash because a variable of the wrong type gets passed into a function, and there's no way to guarantee this won't happen. Good test coverage reduces the likelihood of this kind of bug, but it's frustrating to have to write tests for things that other languages simply do not allow -- it's a lot more work for me, and will never have the same guarantees a compiler can give me.
I think that people can be unkind when comparing programming languages, often simply to make themselves look smarter. Try not to let these people bother you :)
If you want to know more about different type systems, I recommend Destroy All Software's article here :) destroyallsoftware.com/compendium/... It does a nice balanced job of explaining and comparing different approaches, including Python's.
Great post!
Python 3.5+ supports type hints, but that's only for your linter (and other static code analyzers) versus not having it compile.
It's a step! =)
And unit tests. Unit tests contribute much more to reliability than type checking.
I hear what you're saying about the dynamic (or, weak) typing. But I've always believed that weakly typed languages are a bad choice for beginners -- for exactly the reasons you've been learning to appreciate stronger typing. Weak typing might lead to more instantly gratifying accomplishments in the beginning, but as the beginner's software grows into something more complex, already established bad type-ing habits lead to some of the more difficult to debug errors rooted in the subtleties of weak typing. As you've pointed out, strong typing removes that ambiguity, leading to clearer code. It might be more verbose at times, and also less tricky and impressive. But when it comes to the actual computing that happens down under, there's really no difference. And when someone else takes on the maintenance of that code, the one thing their going to want is straightforward, obvious code. Cool, trick, obfuscated solutions waste time and money.
Like I've been saying in this thread, Python is good for what it's good for. As for pedagogy, especially for those who wish to be industrial software developers, I don't think Python is it. I believe schools who start out with Python do so because it's the in thing right now.
I think it's really interesting to think about what is a good programming language for people to start with. It's something I have conflicted feelings about.
I think you might be right that Python is not a good first-language choice for people who want to be professional software developers. But I also think that software should be open to more people than that.
I think it's difficult to balance the advantages of learning things "right" the first time, and the concern that people might not learn anything at all if the content feels inaccessible. I worry about people picking up bad habits/not ever learning what is going on under the hood of their Python program, but I worry even more about people giving up on learning to program altogether.
Perhaps the answer is better teaching approaches & materials for languages that are considered more difficult to learn. Perhaps our entire approach for teaching programming needs updated so that the chosen language is less of a big deal. I don't know.
I think you may be right that some schools start out with Python because it's trendy, but perhaps there's a reason for that trendiness. It's definitely more accessible than, say, Haskell.
Python is good for what it's good for. For the rest, I code an extension in the appropriate language for the task and call it from python :)
Hi Jason! I think I agree with you that Python is not a good language to start with. But what is your suggestion for a starting language?
Actually I've seen that Oxford starts with Haskell, which I think is pretty unique. I can tell you I mostly see either Python or Java for starting choice! Usually after covering Python and Java there is gonna be some short C/C++ just to ensure everyone is on the same page.
I tried experimenting with Julia(incredibly easy to math your way to a result), Go and Rust and there was something satisfying about those(I'll say how easy it's gonna be Julia-->Go-->Rust or Julia-->Rust-->Go)
How often does wrong type bite you though? Many strongly typed languages allow passing null as any type anyway and I find that a far bigger problem than passing foo when a bar is required.
Atleast treating white space (indent) as a language structure always seems to me odd.
The combination of braces to implement structure while using indentation to visually convey structure seems odd to me. Seems like a violation of the DRY principle.
Python removes that redundancy by using indentation for both, that way visual structure is always consistent with actual structure.
Whereas many other languages are redundant in that respect, which does not respect the DRY principle.
Wait, did I already say that?
We are afraid of what we do not understand, we hate the things we are afraid of. Also some devs really hate it :))
It is hard to find good answers to your Q, most of the hate is for things that Python isn't and shouldn't and don't want to be: a static typed compiled language.
I for one hate it because it took all the libs and love for all the science related stuff. To play with ML algorithms I had to learn a bit of Python.
I also hate it because of the "indent" design, to delimit a set of instructions using something invisible is simply wrong, it didn't bother me much but being so popular it affected many things along the way (IDE, tabs vs spaces war) even new language design specs, snippet from Go's
Embedded snippets seems like a pretty limited use case.
I learned BASIC, then Fortran, then Pascal, then C. Then I took my first programming language classes and also learned the rudiments of Lisp, ML and Prolog. My first job was mostly coding in C, and Perl. Then I learned Java. Heaven had come down to Earth. Strongly typed, elegantly laid out, (fiercely) object oriented. It was software development in a world built by George Orwell! Ah the peace and serenity of a highly structured life with heavy-handed enforcement ... but it was sort of compiled, sort of not. Development was slow on those old Celeron processors. I put up with it for a long time. And then I saw PHP... sigh. Fast, loose, messy. But development was rapid. PHP 5 came and OO took stronger hold and Symfony came out. As long as I was disciplined I could pretend I was coding in Java and deploy to test systems faster than you can type "git push" (or was that "svn commit"?).
Somewhere in that timeline Python came out and every time I looked at it, I wanted to read the philosophy behind it because it looked like such a step backward. It reminded me of Fortran in a number of ways. And when I read the original Python author's ideas of how and why, I was even more put off. So many changes with no good reason except for, essentially, wanting to not follow the course of history. I like following convention because, when shit just works you save money, time and headaches. It's when it doesn't work, or something is proven to work better, you spend the time and money making the jump.
So why do I use Python? I hate coding in it, but there's no denying that compared to any other scripting language (I've encountered) it just works. It connects to devices and networks and databases with the least hassle. Easier than Java and PHP (and of course Perl) in this regard. It's ugly. It's not easy to absorb another's Python work. But It. Just. Works. That's time and money. That means more time for everything else I was supposed to have gotten done yesterday.
Python is great. Much more elegant than two of the bigger languages out their, that will remain nameless.
Maybe the people you ask miss {curly braces}?
The main reason why people don't like Python is because they didn't give it an honest try. The main issue people generally have with it is completely superficial and goes away once you spend time in it for a while.
I bucked that trend. I gave Python a nice try. I still don't like it, but I use it regularly for what it's well suited for. The problem is that everyone wanta to scream from the top of the highest mountain that their personal choice is the golden egg that everyone's been chasing. A fool's myopia.
I would counter your premise by saying that the main reason people like something is generally because it was their first love, or close to it. Gosh, have I been swayed by @agazaboklicka 's "comfort zone" post? :)
The only bad part I have read about python is that it doesn't do multi-core threading or something like that which is handy for processing a crap load of data. Other than that, beats me, I like python, who cares what other people think.