5 ms·
I work on a monorepo and MyPy and Flake8 was such a PITA at first but after you use it for a while, you really see the value of type checking. Makes unit testin
by syntaxing 3y ago
I work on a monorepo and MyPy and Flake8 was such a PITA at first but after you use it for a while, you really see the value of type checking. Makes unit testing better and the code more robust in general. MyPy is seriously a great tool, especially with pydoc enforcements.
- softirq 3y agoAt that point, why not just use Go? It's designed to feel dynamic, provides concurrency primitives out of the box, and it's orders of magnitude faster for most tasks.
- pjmlp 3y agoIt is a downgrade in language features, there is always PyPy.
- softirq 3y agoIf you don't consider static type and built in concurrency primitives features then ok, at what point does nice to have features outweigh performance gains and the robustness of static typing that directly impacts the quality of the end user experience and the readability of the code to other developers?
- pjmlp 3y agoPython has built in concurrency support, stuff like Mypy and IDE tooling make up for the dynamic typing. And if that isn't enough, the answer is OCaml, F#, D, C#, Java, Scala, Haskell, Kotlin, C++,... definitely not going from horse to donkey in language features.
- orangecat 3y agoreadability of the code to other developers I disagree that Go's insistence on verbosity improves readability. Each individual line may simpler, but the larger purpose of the code is obscured in all the "if err != nil" weeds. My unpopular opinion is that Dart should get a lot more attention. Strong typing with null-safety, compiles to native, batteries included, and nearly as expressive as Python.
- randomdata 3y ago> but the larger purpose of the code is obscured in all the "if err != nil" weeds. That's the difference between script and system programming. When writing scripts, one is only concerned about carrying out a certain task and if anything goes wrong the whole thing can bail. Systems are more robust. When things go wrong they cannot just fail. They need to recover gracefully and do something meaningful in the failed state. Handing failure conditions is the primary purpose of system code. Irrespective of Go, there is something to be said about some kind of identifier that says "take note: this is the most important code in the application!" If that comes across as being 'weedy', you know that you really needed a scripting language, not a systems language. Different tools for different jobs.
- gaganyaan 3y agoGo still picked a terrible option. The `?` operator in Rust is way better, proving that systems languages don't have to suffer Go's choice.
- randomdata 3y agoThat is quite different. ? in Rust signifies "this code is not important" Which even in systems is unavoidable, to be fair. Sometimes failure just isn't important. The division between systems and scripts is not perfect. But, that will be the uncommon case in systems. It is not certain that really needs a symbol in which to draw attention. (An implementation may need a symbol, but that's beyond this discussion)
- gaganyaan 3y agoI'm not sure why you think it's unimportant. You seem to be confusing its purpose, and making distinction between systems and scripts that doesn't apply here. Rust's whole error handling, including the ? operator work great for embedded systems where Go isn't enough of a systems language to even run. EDIT: I think you're confused. The ? operator says "I'm not handling this specially here". That doesn't mean the error is just propagated to the top like an uncaught exception in a Python script. It allows you any level of granular handling you'd like.
- randomdata 3y agoIn fairness, if you are choosing a language based on language features, you are not going to choose Python either.
- pjmlp 3y agoPython is quite rich in language features, C++ like, most people tend to think it is like BASIC, but it definitly isn't.
- diarrhea 3y agoYep. Some people complain about C# having too many bells and whistles these days, but Python matches almost 1:1 in language features. It’s vast.
- maleldil 3y agoWhy not? The ecosystem might as well be a language feature, and Python has one of the strongest for a lot of areas, not just ML. Also, what is Python lacking that other languages have? It's expressive and fast to develop, and with type hints and linters, reasonably robust. My main complaint is performance, but I'll take the speed to write most days.
- zelphirkalt 3y agoTCO, multiline lambda, fluids/parameters, to name a few.
- FreakLegion 3y agoTCO is available in Python if you want it. Multiline lambdas can be had by abusing the walrus operator, but in a language that supports nested functions it's a bit pointless. Assuming you meant fluents, you can write most languages in that style if you want to, including Python.
- zelphirkalt 3y ago
- stusmall 3y agoI've introduced mypy to a project in the past. It was part of taking an older, low quality code base and stabilizing it into something useful. Sometimes you can't just throw it all away and start over and need a gradual approach that will start paying some dividends immediately. mypy fits that bill.
- diarrhea 3y agoIt makes unit testing better in the sense that it can obsolete a good chunk of it, even.