Effectively Overcome Python’s Shortcomings with Go+

Complementing Python with Go+

I have been working on distributed deep learning systems for 13 years. After Xu Wei asked me to take over his original PaddlePaddle project in 2016, my personal experience of Python in industrial systems made me know more about the limitations of Python. So far, Go+ is the most reliable compensation solution.

Advantages of Python

Python has flexible syntax and integrates convenient features of many other languages. Like C++, Python allows operator overloading. The NumPy authors overload arithmetic operators for tensor operations. Like Lisp, the eval function of Python recursively implements the Python interpreter, which can explain and execute Python expressions, so that Python programs can be self-generated.

Limitations of Python

Python’s advantages also cause some limitations. For myself, I have experienced the following pain points.

Difficult to Guarantee Code Quality

Flexible syntax indicates that a program can be written in multiple ways. In modern software engineering, people cooperate with each other instead of working independently. Multiple possible writing methods can easily cause quarrel during code review because no objective selection standard is in place. This problem is common to many other languages, such as Java. To solve this problem, the community defines some design patterns. Before programmers develop programs, they first check whether a design pattern is already available. Therefore, Java programmers must learn not only Java syntax but also design patterns. This is also true for the C++ language. One of the solutions to the preceding problem is a code style defined by Google. This code style determines the syntax that can be used or not. According to Rob Pike’s explanation, selecting allowed syntax is the original design intention of Go. Python is too flexible so that its code style cannot be defined in the same way as C++. PEP8 can only specify typesetting requirements and almost does not limit syntax selection. Python cannot define patterns either because there are too many patterns.

Difficult to Optimize Computing efficiency

Python has rich syntax and strong flexibility. Therefore, it is complex to write an interpreter and difficult to optimize performance. By contrast, the Go language has simple syntax, better expressiveness than C, and fewer keywords than C. This simplicity makes it easier to optimize the performance of Go programs. Several years after Go was published, the code performance optimization level of the Go compiler quickly approached the optimization level of GCC for C++ programs. Like Python, C++ has rich syntax, so it is difficult to develop code performance optimization functions for the compiler.

Attempts to Conquer Python Limitations

When I was responsible for the PaddlePaddle project, I made a self-driving boat attempt with my coworker Chen Xi to verify the Paddle Fluid capabilities. To do this, we wrote an imitation learning method with Fluid to enable a boat to learn driving skills of human drivers. For more information, see series blogs at https://zhuanlan.zhihu.com/p/38395601. In this attempt, if we bring MacBook Pro that runs Python programs aboard, it will be power-consuming. On the other hand, embedded devices are not suitable for running trained Python programs. If we upload data to the server for training after the boat stops, it will be too slow for the boat to learn from human drivers.

Go+ and Data Science

The preceding attempts remind me that we must select a language with clear, simple, stable, and easy-to-learn syntax. Users of a language must also have exploration spirit. Go+ and its user groups based on the Go community ideally meet these requirements.

x := numgo.NdArray( 
{1.0, 2.0, 3.0},
{1.0, 2.0, 3.0}})
x = numpy.ndarray(
[[1.0, 2.0, 3.0],
[1.0, 2.0, 3.0]])
x := numgo.NdArray(
[[1.0, 2.0, 3.0],
[1.0, 2.0, 3.0]])
x := numgo.NdArray(
[1.0, 2.0, 3.0;
1.0, 2.0, 3.0])

Go+ and Deep Learning Compilers

In the preceding sections, we have mentioned deep learning technologies. Deep learning is another field where Python is widely used. It is naturally related to data science. For example, the tensor data structure of PyTorch and TensorFlow is the same as ndarray of NumPy. In the deep learning field, compilers is the latest mainstream research direction.


In my opinion, the core strategy of future Go+ projects is to maintain simple syntax of Go and properly add flexibility, but not too flexible like Python or C++.

About the Author

Wang Yi is a researcher at Ant Group and the owner of the open-source SQLFlow and ElasticDL projects. He has been writing code since 10 years old. He once used a welded circuit board to expand the “China educational computer” and transform an old-fashioned Weili twin-tub washing machine into an automatic washing machine. He developed his first computer game by using the Apple BASIC and 6502 Assembly languages. At high school, he taught himself all the computer courses for a regular computer-majored undergraduate, took part in National Computer Rank Examination (NCRE), and obtained the certification of “programmer”, “senior programmer”, and “system analyst”. He has been engaged in artificial intelligence (AI) infrastructure for 13 years, served in several leading global Internet companies, and started businesses in Silicon Valley U.S and Beijing China.

Original Source:



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store