
Ask HN: Go or Python? Expanding my toolbelt - MTemer
I have no desire to learn JavaScript, and by elimination I&#x27;m between Go and Python 3 (CPython?).<p>I&#x27;m talking about <i>really</i> learning the language. Not just doing some quick side project.<p>What would you choose? The deciding factors for me are: being future proof so my knowledge could be used in the next 5 years, cross platform, and has a solid, consistent standard lib. I&#x27;m looking for a &quot;can do several things with it&quot; language that can also help me to be a better developer (by exposing me to new stuff). I might use it for scripting or cli tooling but (ba)sh and powershell served me well so far.<p>I&#x27;m not considering mobile since I&#x27;m tired of Java and I have no desire to use the Apple ecosystem. But of course that it would be a plus.<p>I was also considering C# (is there a TL;DR? so many keywords and revisions that I already lost any desire to learn it) but Microsoft worries me. My tools and workflows are Linux based.<p>Python being slow worries me and maybe most of my effort would be spent in learning to produce pythonic code instead of learning deeper concepts.
======
gh1
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...](http://blog.hackerrank.com/emerging-languages-still-overshadowed-
by-incumbents-java-python-in-coding-interviews/)

2\. Python has a good standard library. It has been around for a while now, so
it also has a huge number of high quality third party libraries.

3\. Python is slow and this is a serious disadvantage. However writing
Pythonic code is an aspect of Python that I absolutely love. I think Guido's
guiding principle "code is read more often than it is written" is quite true
and writing beautiful code is a thing worth learning. Other people will love
you for it.

~~~
peller
> 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.

------
holografix
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.

------
kixpanganiban
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.

------
cbanek
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.

------
gigatexal
Python since it's stable and mature. Or if you're deadset on supposedly easy
(at the cost of memory) concurrency, Go makes more sense and it's newer and
all you'll get e-peen points for being on the cutting edge. Python's been
around 20-years.

~~~
gigatexal
also python need not be slow, but it need not be used for everything. There
are jits for it and you're not beholden to CPython either.

------
grok2
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 ;-).

------
sethammons
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).

~~~
MTemer
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?).

~~~
sethammons
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.

------
EthanBrady
One factor I would consider is how different a language is from what you
already know. For example, learning something like Haskell, Elixir, or Elm
(Elm is fantastic) might help you grow more as a developer because you'll be
introduced to entirely new ways of reasoning about and solving problems.

~~~
MTemer
I think I'm too dumb to learn how to use something like Haskell (properly). I
have a memory/attention problem, medication helps but I almost gave up
programming for it. Don't get me wrong, my code is highly praised for being
moderately ok, but I have to play my strengths.

I was surprised that all of the Elixir hype seems to have died here.

~~~
EthanBrady
You're not too dumb! You can do anything you set your mind to :)

I totally understand not wanting to dive into something like Haskell though.
Between Go and Python, I personally would choose Go for a long term
commitment. I think the language is simple yet beautiful, has a robust
standard library, and performs really well.

Python can be learned super quickly though, and being able to whip up a script
is useful (you can 'import' seemingly anything). I'd say it's worth sprinkling
in a little Python on the side.

------
vmorgulis
> I have no desire to learn JavaScript... > ... and I have no desire to use
> the Apple ecosystem.

I would recommend to take a look at Typescript and Swift.

Typescript is a better JS and Swift runs on Linux too.

------
tedyoung
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.

------
diggernaut
It actually depends on what you going to do with your knowledge, Go is
definitely more efficient and faster than Python, on other hand Python is more
popular, easier to use, has bigger set of available libraries.

