DEV Community

Discussion on: Go or Python and why?

Collapse
 
j0nimost profile image
John Nyingi

Depends on what he wants to achieve, Python is a simple Scripting/OOP(object oriented uses Classes (reference types)) language used as a Wrapper for AI/Machine Learning libraries, further more has Web Frameworks allowing it to be portable to the web scene. On the other hand Go, is a Simple and Powerful low level multi paradigm language instead of classes it has Structs (value types). Go can be used to build web apps from scratch no need for a Web Framework, highly used in Microservice architecture due to it's low memory foot print. When it comes to comparing the two a number MAJOR things standout:

  1. OOP vs Multi Paradigm: Python is an OOP language that means it follows the classical OOP path; classes require constructor, you have to keep in mind the Inheritance structure (cumbersome for some large developer teams). On the other hand Go does not use classes instead it uses Structs/Interfaces.Well we can't fully say Go is not OOP since it's methods do handle things like encapsulation but no Inheritance

  2. Multithreading vs Concurrency: Go uses Concurrency as a means of attaining multitasking. This makes Go powerful, why? You can track the lifetime of a task which is not possible with Multithreaded languages like Python. This means you can stop a task at any instance of the working.

  3. Scripting vs Compiled: Yes back to this, Python stands out as it is a Scripting language, this makes it very easy to do some quick tasks. On the other hand Go is a compiled language, this means the language has to be compiled down to the machine level. Thus also a consideration as to why Go is faster than Python