4 ms·
I like Python and it's my main language currently after years of C++ and Java. My main problem with Python is that it's really easy to create really messy code
by tinyhouse 8y ago
I like Python and it's my main language currently after years of C++ and Java. My main problem with Python is that it's really easy to create really messy code that no one can follow. And I see it often because everyone is using Python these days. For example, you have an undocumented function with 6 arguments and have no idea what these are (having bad names also doesn't help, but that's not a Python specific issue).
Type hints and annotations are a step in the right direction. But the adoption is still not high. That's the blessing and curse of Python - it supports many good practices but it doesn't force you to use them so it really depends on the programmer.
- BurningFrog 8y agoI have my problems with Python, but I'm not aware of any language where it's not "really easy to create really messy code that no one can follow".
- arcturus17 8y agoBingo. I’ve made disgusting messes of Java, JS, OCaml, C...
- tinyhouse 8y agoTrue but take my function example. In Java for example you will have the types to click on to figure out quickly what the arguments are. Another example? In Python it's "easier" to make spaghetti code because of the scoping of variables that are less strict. I can give many more examples like this.
- goostavos 8y agoAnecdotally, it does feel like a slightly worse problem in Python. It's got an 'easy to learn, hard to master' thing working against it. It's a little TOO accessible (if that makes sense).Hiring Python devs has always been the hardest in my experience. It's tough to separate the wheat from the chaff.
- diminoten 8y agoIt's less a problem with the language syntax and more a problem of the low bar for entry. To put it another way, "3 years of experience writing Python code" could mean hacking on scripts or it could mean Enterprise level system design and implementation. Hard to hack around on scripts in Java.
- tigershark 8y agoI think that the main problem is that novice programmers write python code just because they are domain experts since it’s quite easy to pick up. But sadly it’s not a kind of code that any seasoned programmer would write. It happened to me to reduce a >500 loc monstrosity to a rather manageable 50 or 20 loc or something like that...
- rsj_hn 8y agoAgree. And as someone that is guilty of writing really messy code and then later Karma had its revenge as I had to clean up and professionalize someone else's tangle of python scripts, I think this is common for scripting languages. A lot of times things start out as one-off scripts, which then become personal scripts, which then become shared scripts, which then become critical to back end automation. Especially in the infrastructure/automation space, you'd be amazed at the horror stories of ducktape holding things up behind the scenes. Even in fancy places like big banks, or fortune 100 businesses. Things emerge organically, and most automation doesn't go through a formal specification/design/test/acceptance process. Few people set out to intentionally write messy code. If I had to do it all over again, my earlier code would have been much cleaner.