Quora: Why should I choose Pharo over Python?

Answer:

Despite Python’s incredible popularity, there are reasons why it’s not the ideal programming language. Here are some things in Pharo’s favour that are absent in Python’s:

First, Pharo is a modern Smalltalk dialect. As a Smalltalk, it is blessed with an exceedingly simple syntax, much simpler than Python’s. In fact, Pharo’s syntax can be summarized on a post card! Let’s see Python do that.

Image for post
Image for post

In comparison, Python isn’t nearly as simple and easy to learn.* In fact, some of its features are downright peculiar. But Pharo is thoroughly consistent and predictable.

Second, Pharo is purely object-oriented. It’s all Objects, all the time. This clarity and consistency makes Pharo very easy to use as an OOP language. Not so with Python. You don’t even have to use OOP in Python; its “hybrid” nature makes using the language more complicated.

Third, Pharo’s IDE provides a unique live coding capability. This means you can inspect and modify code and data while the program is running! You have no idea how powerful this is. It practically eliminates the traditional edit-compile-test-debug cycle that has hampered developers for over half a century.

This is one of the key reasons that Pharo (Smalltalk) is the most productive of all the major programming languages, according to Namcook Analytics. On average, Pharo is twice as productive as JavaScript, C++, Java, PHP, Python, and C#. And substantially more productive than Ruby, Elixir, Haskell, and Julia.

Fourth, Pharo is image-based. The Pharo image is exactly like the system image found in virtualization software like VMware and VirtualBox. It allows you to save the total execution state of your program and resume execution later on from exactly where you left off! This is incredibly convenient and useful.

Fifth, Pharo is much more fluid at metaprogramming than Python is. Metaprogramming is one of Pharo’s greatest strengths. It’s comparable to metaprogramming in Lisp.

Sixth, Pharo has lambdas known as “blocks.” Unlike in Python, Pharo’s lambdas have no peculiar restrictions like only allowing a single expression in the lambda?!

Seventh, Pharo is not hobbled by the GIL (global interpreter lock). Concurrency in Pharo is much smoother and more efficient.

Eighth, Pharo supports tail call optimization for recursion. Python does not.

Ninth, there is only one Pharo version; there is no code confusion. With Python, you face a terrible schism between Python 2.7 and Python 3.x. The inconvenient truth is that Python 2.7 will never disappear. Legacy support demands that 2.7 will always be with us, and that’s confusing.

Tenth, Pharo is not afflicted by that horrible, horrible Off-side rule syntax. Many developers absolutely hate using indentation as syntax. I admit, this is mostly a matter of individual taste. If you share my sentiment, then this is certainly a major knock against Python.

Eleventh, Pharo doesn’t have weird scoping rules like Python has.

Twelvth, Pharo’s execution performance is outstanding, thanks to innovations like the Cog VM and Sista optimizations. Python is usually interpreted and this makes it slow as molasses in January.

Thirteenth, while Python is most popular in data science and machine learning, Pharo is no slouch in this area. Python has NumPy, but guess what? Pharo has PolyMath. Python has bindings to TensorFlow, but guess what? So does Pharo! Pharo is perfectly capable of data science and machine learning.

Smalltalk actually has a much longer history in AI than Python does. Smalltalk was used in AI research back in the 1970s at Xerox PARC. By comparison, Python is a toddler!

I recognize that Python has advantages, too, like many more job opportunities and a richer ecosystem of libraries and tools.** But obviously it has much room for improvement, and this is where Pharo can step in.

* While Pharo syntax is not quite English-like, it does read rather like pidgin English, especially if you look at the keyword messages which are effectively self-documenting.

** But these advantages could easily accrue to Pharo if more people used the language. Remember, once upon a time, Python didn’t have many job opportunities and didn’t have a rich ecosystem. It took time to build up these things.

Why shouldn’t Pharo?

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