Live data from Hacker News

Ask HN: Go or Python? Expanding my toolbelt

news.ycombinator.com

11–19 of 19 posts

Re: Ask HN: Go or Python? Expanding my toolbelt

#11
Given some of your comments here about learning a new language to experiment without a clear direction I couldn't possibly recommend Python more strongly.

Wanna build a web app? Wanna dabble in Datascience? Oh you wanna do Machine Learning? How about a desktop app? Game? Yep Some powerful scripting?

Just so easy to get productive.

Re: Ask HN: Go or Python? Expanding my toolbelt

#13
I've written production projects in both go and python. My choice would be python.

Python has a great standard lib which is mature, and not changing a huge amount. It also has a lot of modules that you can pip install.

If you are really worried about performance, you can pick Go, although you might as well just do C++ if you're super hardcore about performance. While the garbage collector has gotten a lot better, it's still a perf hit.

That being said, for most of the code I write, it's only slow in python if I'm doing something stupid. The threading and pool primitives are also very useful.

For simple web services, there are also a number of mature python frameworks (flask, django) that have more features than some of the basic go http server stuff.

It's also a fair bit faster to bootstrap simple CLI programs with python. Argparse is also great.

Re: Ask HN: Go or Python? Expanding my toolbelt

#14
My work is primarily Python, and only a few months ago I started learning Go. Both of them have their own weak and strong points, and I can't definitively say you should go for one over the other, but these may help you consider:

- If you want to get sh!t done, and quickly, go for Python. It's really easy to build things from scratch with Python because of how concise, clean, and clear the language is. Plus, the Python community is huge so there's practically a package for any advanced functionality you need (and it's easy to write one yourself). There's a reason why research giants such as Google, NASA, and the LIGO project use Python -- it's because you get to spend less time getting your code to work and more time actually designing the underlying models. TL;DR: Write and ship code faster, at the cost of actual runtime performance (but PyPy and Python 3.x with asyncio, makes Python more competitive in performance as well).

- If performance is your focus, go for Go. It's a lot stricter than Python because it's a compiled language and therefore you'll get a lot more compile-time errors with regards to variable typing and conventions (reminiscent to, but arguably even stricter than, C++ and Java). On the upside, you'll undoubtedly incur less technical debt, at the cost of spending a lot of time cleaning your code and getting it to work. Go is pretty young, but it's gaining a lot of traction (spawning the likes of Hugo, Docker, and Kubernetes), so if you need your program to be more performant and highly concurrent, go for Go. TL;DR: Spend more time writing code, in exchange for your program being easily concurrent and performant.

Personally, unless I'm writing OS-level programs that require fine-tuning of things such as memory management, I'd go for Python. Some of Go practices and conventions got tedious and old pretty fast.

Re: Ask HN: Go or Python? Expanding my toolbelt

#15
post #9

I think Go matches your criteria. I've put more eggs into my Go basket than my Python one. For myself, I focus on building networked distributed systems. Go helps me do that (and build useful cli tools). I mostly resort to Python for scripting. What type of programming do you want to do? I don't think I would recommend Go for game development or embedded systems (though people do it).

For personal reasons I have to stay a couple of years at my current job (back-end and some ops), I do some boring stuff but the payment is nice. I don't want my brain to slow down too much so I'm looking for a language to do random stuff without thinking much about what exactly I'm going to create. But probably something related to web development, cli tools/automation, maybe a desktop app just to put in my CV (Qt?).

I've seen QT binding libs for Go, but I am not familiar with them. Go shines in the back end, but I think Python would likely be a better choice for a desktop app with far more examples to learn from.

More than becoming an expert in a given language or stack, another thing to consider is learning a domain. I'm partial to distributed systems, but if image or audio processing, or desktop app, or whatever it is what you find interesting, diving into those will keep you from getting stale and make you more marketable if and when you decide to move to a new employer. The tech stack will reveal itself or you will find that it is fungeable. The key for the resume there will be personal projects, meet up talks, and blog posts as opposed to work experience. At my work, we would be very interested in talking to such a person interested in distributed systems.

Whichever you pick, I hope you find fun.

Re: Ask HN: Go or Python? Expanding my toolbelt

#16
post #10

I think you should go for Python. 1. Python is definitely future proof. It is most likely going to be THE language in the near future. Machine learning and AI is most likely where most new breakthroughs will happen, and Python is well positioned to leverage this. Read more here http://blog.hackerrank.com/emerging-languages-still-overshad... 2. Python has a good standard library. It has been around for a while now, so…

> Python is slow and this is a serious disadvantage.

Eh yes, and no. I don't wish to argue, because out-of-the-box, it's an interpreted language with a global lock, and it most definitely is slower than most compiled languages. Sometimes orders of magnitude so. On the other hand, computers are damn fast, the developer productivity gains of writing Python are huge, and there is a flip side, especially for somebody who wants to "really learn the language."

Within the CPython ecosystem, there are tons of well-established 3rd party libraries that take advantage of the speed of C, without your code ever needing to know. Take for example numpy/pandas or asyncio with uvloop. A step up from that, there's Cython, which is surprisingly robust and easy to use. It also makes interfacing with C code rather simple, and thus provides an avenue for optimizing speed-critical code paths without needing to know CPython internals to do so.

Outside of using CPython, there's the well-established PyPy, and the up-and-coming Pyston.

My point is, if you need a faster Python, with perhaps a little bit of effort it's out there.

Re: Ask HN: Go or Python? Expanding my toolbelt

#17
I had a similar desire to learn another language (after 20 years of Java and JavaScript), and Python was definitely on the list. What helped me decide was to look at the projects and tools that I used or wanted to use (and potentially contribute to) and then see what language they're written in. In my case, I'd been doing a lot of Docker and Kubernetes work, so Go was a natural choice.

If I'd been more interested in "Big Data", then Python (or, if I wanted to stay in the JVM world, Scala) would have been my choice.

Either way, Python and Go will be around for many years to come.

Re: Ask HN: Go or Python? Expanding my toolbelt

#19
Both! Python has a fantastic eco-system and you can build lots of things using existing libraries. Go is new and different and useful for server type applications and easy to learn and you can finally figure you what everyone is bitching about when they claim Go is not a good-enough language because it doesn't support generics ;-).
Post reply on HN