The world’s leading publication for data science, AI, and ML professionals.

Why Processing is the best way of learning Python

Learning Python with all of the perks and none of the drawbacks

Perlin noise image generated with a p5.js sketch written by yasai.
Perlin noise image generated with a p5.js sketch written by yasai.

Whether you are an experienced programmer, or you have never programmed before, chances are you have never heard of Processing. Processing is an extremely well-known tool in the field of creative computing and visual arts, but it results in being quite niche everywhere else. Processing is (and I quote from the official website):

a flexible software sketchbook and a language for Learning how to code within the context of the visual arts.

In the above quote, Processing is mentioned as both a sketchbook and a language because originally (back in 2001) Processing shipped solely with a custom/simplified version of the Java programming language thus making it both a language and a coding environment. Since then, a lot of things have changed. Processing has grown into a large community supported project with tons of add-ons, video tutorials and external libraries. Amongst these, between 2010 and 2014, a Python Mode was developed. Since then it is possible to actually program in the Processing IDE using the Python programming language, and I’m here to tell you why this is an excellent way to learn and/or teach Python.

Forget Python installation nightmares

The very nature of Processing makes everything easy to do. From installing the Processing app itself, to getting started using the first provided video tutorials, all the way to navigating complex examples and installing extensions. And here is where the Processing-Python collaboration shines.

Python is a great language to approach the world of Programming because of its ease of use and syntax which is very much close to written English. However, if there is one thing that is definitely not good for beginners, it’s the installation process. Python is very ambiguous and presents itself with several versions (some of which deprecated). Moreover, the installation can happen via a number of different channels: Rodeo, Anaconda, brew, python.org… just to name a few! Processing removes any barrier between the learner and Python placing the installer right in the midst of any other Processing Mode! Select Python mode for Processing, click install, and you’re ready to go.

Somebody might argue that using something like Anaconda Navigator would let beginners achieve a similar result with the same ease of use. However, Anaconda Navigator still maintains most of Anaconda’s powerful features and thus results in a more complex interface. Moreover, Navigator is just a package manager, from there the user would have to select and install a code editor adding unnecessary steps that a Python beginner shouldn’t have to worry about.

Image by Author of the one-click install provided by Processing.
Image by Author of the one-click install provided by Processing.

The power of visual feedback

As stated in the introduction, Processing is a very well-known piece of software in the field of the visual arts. This is because Processing’s strength is the ability to enable a tight connection between code and visuals making it extremely simple to use code to generate visual artefacts. Processing is not the only software that allows this (OpenFrameworks is another big player in the game) but it is definitely one of the easiest and most approachable environments to do so.

When looking at Python in Processing, the benefits are even more pronounced. The scripting nature of the Python language means that users approaching it for the first time usually have to see the results of their first scripts appear in the Python console as text (or ASCII arts if the tutorial they are following is fancy). Processing turns this paradigm on this head and gives the ability to generate visuals from the first lines of code. Being able to see the results of a few lines of code in a visual manner can be an extremely powerful tool to make the learning journey more fun and interactive.

As the learner becomes better at programming, the Processing environment grows with them providing more and more depth in the world of the visual arts: 3D environments, meshes, textures and so much more. Ultimately, even though some day the Processing environment might become limiting for an expert programmer, it provides them with the tools to easily switch to a more powerful environment without breaking a sweat. This without even mentioning that the Processing framework has been declined in many different ways: from p5.js that lets you port your sketches to a web-based environment, to Processing for Android and for Pi that let you run Processing sketches both on mobile and Linux-based platforms.

Short recording of Golan Levin's Processing example titled Yellowtail, translated to Python by Jonathan Feinberg.
Short recording of Golan Levin‘s Processing example titled Yellowtail, translated to Python by Jonathan Feinberg.

Documentation

Finally, last but not least, documentation: the Processing project is filled with excellent documentation! Starting from the reference manual that contains not only explanation of every inbuilt function, but also ready-made code that can be copy pasted into ones sketch, all the way to thousands of video tutorials made by the one and only Daniel Shiffman. Whether you get stuck on a problem, or you simply like to follow along a tutorial guiding you through the intricacies of complex processing sketches, you’ll definitely find what you need.

Image by Author taken from Daniel Shiffman's Coding Train feed to showcase the diverse nature of the thousands of tutorials.
Image by Author taken from Daniel Shiffman’s Coding Train feed to showcase the diverse nature of the thousands of tutorials.

Conclusion

In conclusion, Processing makes getting start with Python more fun and interactive. It provides the user with a great environment to test and learn all the Python fundamentals and supports the growth of the programmer becoming a powerful tool towards the end of the learner’s journey. Whilst I strongly believe that Python’s strength also lies in the management of virtual environments and the installation of external modules, I believe these two topics could be left aside in favour of a better learning experience at the beginning of a programmer’s journey.


Related Articles