Notice: While Javascript is not essential for this website, your interaction with the content will be limited. Please turn Javascript on for the full experience.

Why Python Matters for the VR Community

Why Python Matters for the VR Community

Andrew Beall, Chief Scientist, WorldViz

Believe it or not, Python was first released 30 years ago and for nearly that long we've made it the cornerstone of our Vizard virtual reality (VR) development platform. You may also be surprised to know that VR has been around for nearly twice that long! How we came to choose Python so long ago is a story in itself, but what is remarkable is that even after so many years Python has only continued to become more and more valuable to us and our customers.

For us, Python has shaped our product development lifecycle, and we firmly believe it’s the world’s most accessible and powerful scripting language. You can't help but embrace the rapid application development paradigm, which has enabled us to overcome challenges such as quickly building hardware drivers for a rapidly evolving VR industry. We cater to a scientifically inclined customer base, and Python's rich community with shared libraries provides ready-built functionality that is beyond compare. As it said by others, we build in Python whenever we can and only use C++ when we must.

For our customers, Python plays a central role in their daily experience with our product. One of the core values we provide is wrapping up all the complexity of a sophisticated 3D render engine capable of low-level graphics control needed by researchers all into a friendly Python interface. The fact that Python was purposely designed to be an enjoyable language shows how quickly novice programmers across the board can begin coding projects of their own. Unlike Java and C++, Python is inherently obvious in how to do things, and that single characteristic has led our customers to feel self-empowered and confident enough to explore projects and make discoveries that they would otherwise have felt was beyond their programming expertise.

Three reasons capture why Python is so great for scientists:

1) Python is easy to learn We think this is the most important reason why Python is a great choice for scientific research. We've seen hundreds of researchers with no Python experience gain fluency in a matter of one or two months and successfully build virtual reality experiments. For our customers, the world of 3D graphics and real-time virtual reality environments is suddenly cracked up and ready to be used for research. It gets even more exciting when our customers see how easy Python makes it to collect data from the sensors, save it to files, and then use Python libraries like numpy and matplotlib to add a data analysis and visualization pipeline.

2) Python is easy to read Unless you've worked with collections of code before this point may not fully resonate but trust us when we say this is critical. We've heard countless claims by customers who say they are relieved to now feel that they can read, understand, and even tweak projects built by others in the lab. Alex Martelli, a Fellow at the Python Software Foundation writes that "To describe something as 'clever' is not considered a compliment in the Python culture. Clever programming is often unreadable by anyone except an expert. Python is meant to be easily readable and immediately useful.

3) Python has a huge scientific community It's no joke when we say you can almost always find a useful library by googling "python" plus your target keyword. There are simply thousands of libraries available for scientific research, nearly all being open-source and freely shared amongst an amazing community. Scientists across numerous domains have adopted Python as the goto language for analysis, so it's easy to lean on the accomplishments of others when beginning new projects. Try a similar search in other languages and you'll see a huge difference. Or, compare the effort it takes to incorporate external libraries into Python compared to other languages and you'll be amazed.

What about the performance penalty for using Python? We get this question sometimes and it's usually a red herring. Sure, Python and C compiled code are in different categories and if you pick the right computing problem, you can show C/C++ to be much faster. However, time to crunch numbers or similar isn't what most of our users care about. GPUs and CPUs are so fast today that it's rare that Python's efficiency is an issue. Not rare, though, is how often projects can be completed faster in Python. Identify what matters most to you and measure speed accordingly.

In conclusion, whether you're developing code to immerse a person in a tightly controlled virtual world to study their reactions to stimuli, or you're using machine learning to model the spread of COVID-19, you owe it to yourself to try Python. You won't regret it.