4 ms·
I had an initial period where Go felt really difficult, coming from Python. Now I've adapted and I actually feel like refactoring things is easier than it was b
by potta_coffee 7y ago
I had an initial period where Go felt really difficult, coming from Python. Now I've adapted and I actually feel like refactoring things is easier than it was before coming to Go. Just the fact that arguments and their return values are more strictly defined helps a lot.
- takeda 7y agoThis is not that obvious, since many people are resisting it, but if you ever tried to use type annotations in Python, it dramatically improves refactoring (from my experience PyCharm it actually is more reliable than GoLand), you get autocompletion and bug detection. Highly recommend this for large Python projects.
- potta_coffee 7y agoI didn't like type annotations in Python, but I didn't like Go's type system either when I started. I'd be willing to take a second look at types in Python now. But, my real reason for choosing Go was for performance, and it blows our previous solution out of the water. Go isn't perfect but I'm pretty happy with it for right now. I still use Python for a lot of other things though.
- takeda 7y agoWell, if performance is the objective, then I can't suggest Python, because that isn't the goal. You can still have a performant application implemented in Python, I for example had it encode video stream on the fly, but this of course is done through extensibility via C extensions and the core work wasn't really done in Python itself. Sometimes with the right approach (mapping PostgreSQL calls 1:1) and right tooling (uvloop, Cython) you can write code in Python and still squeeze better performance than in Go[1], but you need to know what you're doing. If you want to explore types, these resources[2][3] were useful for me. [1] https://github.com/MagicStack/asyncpg https://github.com/MagicStack/asyncpg [2] https://mypy.readthedocs.io/en/stable/ https://mypy.readthedocs.io/en/stable/ [3] https://docs.python.org/3/library/typing.htm https://docs.python.org/3/library/typing.htm
- potta_coffee 7y agoI realize that with a lot of effort, Python can be performant or can be scaled. It was a pretty low-effort move to rewrite my Python service (which was pretty small) in Go and go from really poor performance to acceptable performance right away, and it only took me a short time. Also, I'm pretty good at Python but I'm not very knowledgeable about optimizing it for performance. I'd like to learn those tricks though.