Go or Python and why?

So a friend of mine was considering either learning python òr go. What would be your advice to him?

Did you find this post useful? Show some love!

Based on the info, "Yes he is planning on building an app", I'll assume we're talking about full-stack options for an MVP web app. We could also be discussing a language for a general backend that may support web + mobile apps. I like Python for MVPs. It's an approachable language with solid, opinionated frameworks like Django and Flask you can become productive in relatively quickly.

As some have already mentioned, Go is faster than Python because Go compiles "like a bat outta hell" from what I understand. That said, it's rare to run into performance issues until you achieve significant scale. Even then, the likes of companies such as Youtube and Google demonstrate it's possible to maintain efficient production services at scale using Python.

Even though I lean towards Python, Go is a fantastic language too from what I've seen. Your friend can't go wrong either way. These conversations about which language to pick always boil down to the bias and experience of the responders. Every language has technical tradeoffs. Most of those tradeoffs can be dealt with and won't make or break the performance of the app.

It should be noted that Go was created essentially by Google to solve some performance issues they encountered with Python at scale. That said, for most applications that aren't Google scale, it comes down to the other factors, such as developer productivity.

To provide more details!

Is he a new developer? Seasoned? What motivated him to pick between those two? What does he want to accomplish?

Yeah, more details will help. Without knowing more, here are some thoughts:

  • Python might be more “practical”, all else equal.
  • Go probably looks better on a resumé, all else equal.
  • Python has the big academic/data community, and has a ton of supporting libraries for this kind of work.
  • Go has features built more specifically for scaling and was developed with some “modern” problems in mind. But nothing’s a silver bullet.

Those are some thoughts from what I know of each language/community. I may have oversimplified some of the points but I think that’s a decent gist.

I'm a huge fan/primary user of Go but I also love Python since that was my first proper language; I totally agree with these comparisons. One thing I would add that I've found immensely helpful is the incredible documentation and explanatory pieces available through the official Go organization. It's a very knowledgeable community that explains things clearly (not that other groups aren't, it's just what I've found to be the case with Go).

Yes he is planning on building an app that will high performance, security and a one that will scale as it grows. He is actually considering a dating app . He is from a perl background

If he is considering building something "proper" he should probably try both languages to see what he likes.

9/10 Go will be a lot more performant than python. But quite often it's not the programming language which really limits your performance.

Is he planning on making this as a desktop app? Because unless the answer is yes, neither of those languages are possible options.

Everywhere I used to use Python, and I have a choice, I now use Go.

The primary reasons I can see for sticking with Python:

Shell scripting - when you want to run a script from a shell, rather than an executable. Go has a few limitations that get in the way of making this easy.

Python might have libraries not yet available with Go.

You’re working with an existing Python code base, and not planning on making many changes.

Go gives you:

Powerful concurrency tools

Static type checking, and duck-typing form of interface support

Powerful developer tooling

Fast execution, with low memory footprints

Fantastic compatibility guarantees

A simple, concise language

Essentially the same line-count (I’ve tested this by rewriting code in Go that I previously wrote in Python, and it ended up effectively the same.)

If you have the chance to choose, I recommend to choose go.

Ben Halpern DEV.TO FOUNDER

Hey there, we see you aren't signed in. (Yes you, the reader. This is a fake comment.)

Please consider creating an account on dev.to. It literally takes a few seconds and we'd appreciate the support so much. ❤️

Plus, no fake comments when you're signed in. 🙃

I would choose Python for web development, but then I don't know Go. There are Web frameworks for Go as well. However, if you use Python with Django or Flask, you will probably have an easier time hiring developers who are familiar with those frameworks if your app takes off.

I don't think the speed of the language is going to be a limiting factor (in webdev it's usually download size or database queries that slow you down). If it ends up being an issue, there are things like Cython for that.

Python lets you work at a high level of abstraction, letting you get more done faster, which wouldn't usually be the main focus of a systems language like Go, but again I don't know Go, so it could be great at that as well for all I know.

Where I would start looking at Go would be if I wanted a lot of low level control, e.g. of system calls, memory, drivers, threading. I would also look at Rust in this case, as it's another newish systems language that has a great community.

If your friend just wants to write a few programs, I'd say Python. If they really want to get into programming as a whole, I'd say Go.

Python is great for getting what you need done, but it's not good for teaching people the fundamentals of programming, so I wouldn't recommend it as a first language.

Go is an extremely simple language with very few features, so it's great for teaching programming fundamentals. I'd recommend it over Python if they actually plan on getting into programming more

Hi Dean!

Python is great for getting what you need done, but it's not good for teaching people the fundamentals of programming, so I wouldn't recommend it as a first language.

why do you think so?

Mainly because it's just so simple. How do you figure out if an element is in an array in Python? if elem in arr:

I see Python like a big, soft cushion. It's REALLY comfortable, but you wouldn't want to build your foundation on it. I'm not ripping on Python or anything, I just think it's a bad fit for a first language.

EDIT: Think about it this way. If you learn Python as a first language, why would you ever want to learn a language where you need to use a for to see if an element is in an array?

I dunno, I'm conflicted on this. I don't think one necessarily needs to learn pointers and linked lists to learn how to program. I do think Python is a good first language exactly because you don't get lost into implementation details.

Would you make the same argument for a purely functional programming language?

You can still use a for on an array if you want to, Python doesn't prevent it, you can do it for learning purposes.

Python for math or science, Go for almost anything else. Python has massive support for scientific programming, and its quirky language tricks (read: dynamic typing) make it quite concise for that purpose. Go is much better for maintaining large codebases and forcing you to make clear and good decisions regarding code structure.

I have been dabbling in both like just as a beginner. I would suggest python if your friend is more towards data analysis and data science stuff and go if you are looking to build apps related to cloud.

I would advice to leave this decision to the bitter end, first layout the architecture (monolith, services or serverless..), choose technologies and then the languages.

For example if he does the front end too he will have to learn JS too, so he could minimize the time to product by choosing JS (nodeJS) instead of Go or Python just because he doesn't need to learn another language.

There are also different styles of programming, communities sizes, tools and environments to be considered on a specific level (his personality, knowledge, preferences and the app requirements) for Go vs Python.

But most likely he doesn't want to hear and consider all that, so I'll comply and just respond Go.

I would say learn Rust, because it has the advantages of speed, concurrency and safety.

Speaking from personal experience

However I have also almost finished learning Go as
I need to read code in Go (gossipsub as part of libp2p) for developing a sharding network as part of Drops of Diamond for Ethereum, and before learning Rust I learnt VBA, C++, Solidity, Python, and Vyper, in that order. I also use Python for reading Ethereum research code and implementations (e.g. of EVM and Casper).

I've used go for about a month now. I still missing out many of the stuff because its a mind fuck language in the good way. Because it its not C based. and does a few things strange. but once you get to know it it becomes simple to work. and the good thing for me is that there is only a single way of doing things. this actually helps in terms of, the wheel being created many times as happens with python. I've used python for over 7 years now. and I must say Go is a good way to go. I just don't like a few things that python has in favor here is my cons.

  • Lacks of remote libraries versions (Guess you can solve that with git branches)
  • It's kind of hard set it to work, since you have to create env variables
  • makes it difficult to separate code into many .go files amount the whole project
  • Little documentation.

Use Go and then if your friend gets into building a reals project and it's much easier to build with python he would be able to jump to python and learn it quickly.

Classic DEV Post from May 10

If your programming language were a Pokemon, which would it be?

...

READ POST
Follow @ben to see more of their posts in your feed.
Albert
I am a believer || Ruby for the backend and React for the frontend.... I am a speaker st tech education confs. When am not coding, I am reading🤗🤗
Trending on dev.to
How to start machine learning with Keras (Windows)
#machinelearning #python #beginners
How to Set up a Twitter Bot with Python and Heroku
#python #heroku #flask #twitter
Masonite Python Framework Knowledge Series: Part 1 - Understanding Auto Resolving Dependency Injection
#python #programming #framework #masonite
Testing in Go: testing floating point numbers
#go #testing #softwareengineering #technology
Will there be more GoLang's jobs in the future or not.
#discuss #go #career
What was your worst experience with a programming language?
#discuss #programming #python #experience
Saying "Hello world" using Masonite Framework
#python #framework #masonite
How to start machine learning with Keras (Ubuntu, Linux)
#python #keras #beginners #ubuntu