30 Comments
May 21·edited May 21Liked by Jos Visser

This was simply a satisfying and stress-relieving read after being forced to develop a program in Python knowing that someone thinks the same. It was an absolute nightmare spending time debugging in Python.

Python is an absolutely horrifying language to build a proper program. It's like trying to build a house on top of a base that could collapse at any point. At first, it may seem that it doesn't take much effort to build the base for a program in Python, and it is. But, low-effort work only results in low-effort product. Languages such as Java, C/C++ or Rust definitely take more time for you to build the base, but it is extremely solid and can support your program over a much, much longer period of time.

And those languages definitely takes a lot more time for you to grasp a proper understanding. But once you do, you can see a solid and strong connection between everything. Python takes little to no time for you to understand it, but your understanding is rather lose. And that will only backfire when you build large programs as that lose understanding will only result in you barely being able to draw connections between anything, turning debugging into an absolute hellhole.

As a person who prefers to have a good understanding of whatever I'm doing and not just "it magically happens", I can never see the "improvement in efficiency" when developing in Python. I only see a 10 times decrease in efficiency compared to C++. Hell, even something such as JIT Javascript is more efficient than Python for me.

And then we have how incredibly slow Python is. And then you'll have to install a shit ton of libraries to make it better. And then you realize that's like installing hundreds of fan-made mods into a game and hoping that it won't crash.

Expand full comment

Meta's new thread backend was written by https://github.com/facebookincubator/cinder which is based on python 3.10.

Expand full comment

Absolutely true in every sense. I was/am a programmer from the 80's using pseudo code to test the functions. Then we used a suitable language. BBC basic is so superior to python I dont understand this almost star stuck liking for python. Declaration of variable types is a MUST if we are to manage memory. Oh python does that for you...really?

Best programming language for nerds ? APL without doubt 1 line in APL is a thousand in any language😀

Expand full comment

The syntax/semantics/paradigm/etc of the language you use is almost irrelevant compared to other factors that have a much bigger impact on projects. Team experience and familiarity, development management/processes/practices, support tooling, documentation, language ecosystem, language maturity, management support, etc, all make a much bigger difference to the outcome.

I've worked on a large (aerospace) project using macro-assembler where after more than a year of coding only a single bug was found during integration testing. AFAIK that is the only bug ever found in that software. It went well despite the "crappy" language because everything else was in excellent order, and I personally found the language a joy to use.

I've seen Python projects that grew into terrible messes, and people claiming "Python is unmaintainable compared to C++". However, those terrible Python programs ran (and accumulated cruft hack fixes) for years, while the other C++ programs around them were re-written from scratch multiple times.

I've seen projects using "cool new languages" stumble over all the immature-language sharp edges like compiler bugs, crappy error messages, poor documentation, insufficient debugging tools, missing libraries, steep learning curves, etc. Support for excellent type-checking, contract-programming, memory safety, etc become largely irrelevant when you run into these problems.

Personally, I don't care much about the language, the language ecosystem matters more, and the project procedures/processes/practices matter even more. Given unlimited language choice I will choose a mature language I know well using a paradigm that fits the project, unless I'm intentionally planning to assess/learn a new language (in which case I know the project is going to suffer for that).

Expand full comment
Aug 2, 2023·edited Aug 2, 2023

Oh my oh my, finally a post of yours that I can (mostly) disagree with!

I too pushed and argued for rewrites out of Python. Python 2.7, that is. However, Python after 3.10 is a _different_ language. Good static typing (actually good, not fake), pattern matching (!), etc. etc. And now, proposals on removing the GIL.

Also, Python has proper exceptions, compared to Go's "if err != nil" manual handling of errors (unless they finally implemented better error handling - haven't checked in the last 2 years). I consider this the biggest fault of Go, which (probably not for good reasons) has put me off. I refuse to have to manually check for errors, when the compiler can in all sane languages generate code to do it. Yes, even in Python 😅

Expand full comment

I wouldn't say it is radically different. Most already existing code does not make use of these features. This may change, but static typing will always be an after thought without strict guarantees.

I agree with the author on a lot of points. I recently had to refactor an application written by a PhD student over the course of 3 years with no docs, no comments, no tests, and basically every convention in the book broken. People might say the fault is most definitely the developer for not following best practices. That's great to hear, but it doesn't change the fact that the code is a piece of spaghetti. Static typing saves time even in the worst case scenario. I don't want to have to mind read the author to know what entpath(A, B, C, D) does and spend hours understanding what the type of a single parameter is.

Expand full comment

Well, of course a three-year old codebase is old. But we were not talking, I thought, about code written by students, but whether Python is a valid language (not the best, but a valid one) for large projects.

My point was, that it seems Joss' point of view is about old-style Python. And my view is that today, a lot of that criticism is _less_ valid than it was 10 years ago - basically, the cost of writing good Python today is much less than in the past, almost to the level of a reasonable language.

I still prefer to write in Haskell in my free time. Neither Python, nor Go, are strong enough in types to make it worth the few hours I can afford to take from family. But I do appreciate the effort that Python community is going through to make it a better language.

Expand full comment

I write test automation. Python is a nightmare. I'm sticking to C#

Expand full comment
Apr 7·edited Apr 7

Believing that a programming language that verifies the types of data manipulated will solve the problem is a chimera. I started programming in 1975 and have used some twenty different languages and written, at least, 10,000 lines of code in each of them. So I also have a certain amount of experience... It's perfectly possible to write horrors in every language I know. There are compiled languages, which are convinced they know better than you and will push you to write some of the worst monstrosities, simply because the compiler doesn't understand the asynchronism of certain functions. Writing code requires a great deal of discipline and rigor. Personally, my Python codes all have the __main__ part used to test all functions, methods, objects, etc. in each file. My Makefiles are designed so that the library can only be installed if all the tests have been validated, and so on. I've used Python for very large applications in critical areas such as the financial markets, where every millisecond counts; 24 hours a day, 7 days a week. No language is going to turn a bad programmer into an extraordinary developer... alas...

Expand full comment
author

Strongly typed programming languages are not a panacea, but they do make it easier to write programs small and large that are more reliable and that are easier to maintain. It is totally _possible_ to write good programs in Python that are easy to maintain, I posit it is just _harder_ than with languages that support strong typing. That doesn't mean that it is not possible to create terrible programs in these languages.

Expand full comment

100% of this text is wrong, you are confusing python with its default implementation Cpython, on the other hand, all those problems that you say are from "python" are a consequence of its misuse and a rampant ignorance about good practices when it comes to using python, that way of working makes you eventually end up with garbage code regardless of the language

Expand full comment
author
Feb 18·edited Feb 18Author

This comment is 100% wrong. Your argument is basically: If you write all code perfectly following all appropriate patterns then it is possible to write great code in Python. This is undoubtedly true, but shows a lack of understanding of how practical software engineering in the real world actually happens. Taking a chance to derail this thread completely: Your argument is that of the NRA: If everyone who owns guns behaves responsibly all of the time and under all circumstances, there is no problem with widespread gun ownership. Reality begs to differ.

Expand full comment

People mentioning how great python is... Well actually the "libraries" are great. Basic python does nowt without importing a whole load of external stuff. Cant even find cosine without importing. Oh well Always BBC Basic

Expand full comment

Ok… thanks for the link. So I see this Jekyll and Hyde scenario going on here… so I will just stay out of it. Thanks for giving me the total picture. Even though I can’t say I understand what you are trying to achieve, the two articles do represent a balanced viewpoint, for which I thank you. If not already… these articles could be published as a series that makes their connection more obvious. Best of luck in your programming and writing! Thanks for the dialogue.

Expand full comment

I get that, but that is not what comes across. Python IS the right tool for many jobs and I think you could have ended with that. Netflix and others have built fortunes and great user experience with Python and with new programmers reading your post, you have a responsibility to tell the whole story. This was a rage quit of a rant that says more about you than it does about Python. You didn’t mention PEP or any efforts to make Python as useful as possible. You just pooped on something that is bringing peoples ideas to life everyday. Without Python, and maybe R… I don’t know if Data Science would be what it is. I mean… Python string manipulation is unrivaled. Python libs are unmatched. There are tradeoffs that deserved mentioning and tradeoffs is what programming is about. Try being balanced, not hyperbolic. Remember…the kids are listening and the internet is forever.

Expand full comment
Jan 26·edited Jan 26

This is funny! You are mad because you lack the skills to use a tool!? Are you mad at hammers for not striking the nailheads just right. Did you run to Home depot a get a new hammer? Did you google “Best hammers of 2024?” Python is popular with companies because they have legacy code going back like 20 years! Of course these jobs pay well and are plentiful because of all the reasons you mentioned. Python isn’t meant to be perfect. I use Lua, C, Python, and Typescript and I don’t LOVE any of them. I love building things and these are the tools available. If you don’t like the tools, contribute! Write us a language that we can love and call the “best!” You will soon see why certain languages have the limitations that they have. Interpreters, VMs and other necessary nonsense. I would love to see you use C as your “metal language” or 5 different assembly languages. Hope you have 30 years or so to get up and running! If you rewrote software in Rust… and Rust is so great…why did you switch to Go? Did Rust let you down as well? Is Rust not as shiny as it used to be!;-) Spoiler alert! Everything seems shiny when you are running from something else.

Think about what you are asking for just a moment! Computers are not magic, they are science and science has limitations. You sound like my kids asking “why can’t we just use html for everything!” Sorry programming is hard for you. You should probably quit or get really angry and write us the best language we have ever seen! Or… write an article of proposed solutions to the problems…Or, contribute to Python Dev. Otherwise… you just sound like a little yapping dog, upset that you can’t run with the big dogs! Puppy growling with your arms crossed because “programming and refactoring takes a long time….hmph!!” Man up bro!! Don’t relegate yourself to being a little yapping dog, especially the female variety. It’s not a good look.

Expand full comment
author

The only thing I am asking for is that people use the right tool for the job.

Expand full comment

The object model in Python is fundamentally broken. Of course, purists will say "You are using it wrong!" But this isn't the case. To take a simple case, let's say I have a class hierarchy of "People - { teachers, bakers, doctors, engineers} So teacher isa person, baker isa person. I want a class variable that counts how many people are made. The problem is if a method in, say, doctor, tries to access the count, it will get doctor.count not person.count. Of course, you can use person.count to change this but then that implies you understand how the base classes work. For example, if person changes to worker - {person, robot} and I really wanted a count of all workers now person.count is not the right place to go. So I have to fix all my code that refers to it that way. This is the whole reason OOP exists is to avoid this situation! It is clear that Python is a scripting language flexible enough to glue on anything, but that doesn't mean you should. Yes, you can work around (provide a method that returns the count to localize the change). But then that means you do not really have class variables. You say you do, but you don't. Broken. Not that there aren't parts of all languages that might be broken but for your reasons and the broken object model I won't use Python for large projects.

Expand full comment
Jan 27·edited Jan 27

Put a people_counter() method in People and allow its children to inherit it. Collect a return value from each method and store them. Feed those as parameters to a people_counter() function that maintains an accurate count of all People. Make sure your Parent class has a job_switch() method that subtracts or adds people as they switch jobs. If you are making lots of jobs… use an ABC to create an interface or blueprint for creating people.

Expand full comment

Sure, I never said you can't do it. I'm saying that you don't have proper class variables because that's the simplest way to do this and it is fundamentally broken in Python. By analogy, if a language said it supported math. But multiplication only worked if the numbers were <10, you could argue: it doesn't matter. If you need to multiple, say 8 x11 you just have to say: 11+11+11+11+11+11+11+11 that would be correct, but not really useful and no one would make an excuse for that. If you notice I had said "you can work around..." and then provided a broad outline that is similar to your fix. But the core fact remains: what Python calls class variables are NOT class variables. The object model does not have proper class variables.

Expand full comment

Thank you! I wish everyone would read this before writing one more line of code in Python. I'm so sick of seeing advertisements from companies marketing their Python courses to prospective programmers.

Expand full comment

> I once worked with a service in Python that forked worker processes to handle requests, ensuring that all cores could be used.

So? Almost all of us do ~Web. HTTP request comes in, is processed, response is returned. I often have to take database locks in my work to have **less** concurrency.

> ...it's the equivalent of starting to build a skyscraper by putting up a few prefab walls (never mind the foundation) and immediately wanting to use the bathroom. That's not how we build skyscrapers and it's not how we should build software.

This is exactly how we should mostly do it. Get an MVP up and running in a day, build smaller systems into bigger systems. Moon landers & nukes are maybe the exceptions.

> you probably have no business writing software for a living.

This is such a dead end. Yes, there aren't enough geniuses on the planet to go around. What do?

Expand full comment

I agree, and ours not a popular opinion, I'm afraid, because there are far more Python developers out there than there are people how have had to deal with Python code in production, and especially at larger scale.

Python is fine for small scale experimentation. Building large things out of it is sheer lunacy: e.g. the issues with performance, awful dependency management (aka "some guy on the internet broke my code" by making a breaking change to a package that is depended on by a dependency of one of your dependencies... good luck with that), and worst of all, the raging dumpster fire that is Python packaging. It's so bad there's even an XKCD about it: https://xkcd.com/1987/.

Why is there not "one way to do it" when it comes to Python packaging? That motto was a reaction to Perl's "there's more than one way to do it", and the irony is that Perl solved packaging very nicely with a set of tools that all integrate and work well together, and one packaging system. In other words, there's one way to do packaging it in Perl, and it just works.

In Python, there are 14 ways and next year there will probably be 15. None of the tooling from those 14 different approaches interoperates well with the other 13 because they all reinvent the wheel, and none of the "solutions" is feature complete. The fifteenth one will have the same problems because the people behind it will give up partway through solving the problem, like all the groups before them, because it is tiring to reinvent the wheel.

Like you, I write scripts in Go now. Easy to read, easy to make production ready, easy to write rock solid multithreaded code (try *that* in Python!), extremely fast to compile, most potential runtime problems are detected at compile time, good dependency management, and it is easy to package (aka "copy the binary"), etc.

Expand full comment