4 ms·
This. My experience with Python goes like this: "I have to write a really small script... ok, not so small that I can do it with bash. I know, I'll use Python
by the_af 6y ago
This.
My experience with Python goes like this:
"I have to write a really small script... ok, not so small that I can do it with bash. I know, I'll use Python! This is going to be a small, throwaway utility anyway"
(Some weeks later, it's turned into a large monstrosity and I need to refactor something, and everything breaks because refactoring anything nontrivial written in Python is a dangerous proposition)
"Ouch! Python: never again!"
(Repeat a few weeks later)
- disgruntledphd2 6y agoI mean, you need to write tests before you refactor, but that's true in all languages. I do agree (and have the scars to prove it) that this isn't a panacaea but it does help, a lot. That being said, one of the worst bugs I had in python was in passing in the wrong types to a constructor function, and my tests didn't catch that. To be fair, Mypy would have, but I hadn't annotated that part. At the end of that debugging situation, I would have gladly killed somone for enforced static types in Python. That being said, the data model is a work of art, and a core reason why I enjoy coding in Python. It's just a shame that pandas kinda sucks.
- the_af 6y agoI find the problem with writing tests for Python is twofold: - Most Python programs I write start their life as tiny scripts, always with the certainty they'll never grow (Narrator: they always grow). I don't know many people who write tests for their scripts... - Testing in Python means too much effort in the wrong places. Consider that most refactoring problems would have been caught for free by a language with static typing. I've experienced runtime errors because I changed the return type of a function from a single value to a list (or viceversa). A statically typed language would have let me know of my mistake for free, so that I could focus on tests that really matter.
- ghostwriter 6y agoYou can try Turtle next time, if you prefer fully type-checked shell scripts https://hackage.haskell.org/package/turtle-1.5.19/docs/Turtle-Tutorial.html https://hackage.haskell.org/package/turtle-1.5.19/docs/Turtl...
- the_af 6y agoThat's awesome. I love Haskell. Will definitely try Turtle next time!