This blog is dedicated to open, interoperable manufacturing software and the coolest, latest and greatest things I see every day while conducting business under the banner of Inductive Automation.

Hello, my name is Steve Hechtman and I am president of Inductive Automation. During the span of one day there is more excitement, more discovery than I can possibly keep to myself. This blog is, therefore, my outlet. WARNING: This site is highly biased in favor of the most powerful, affordable manufacturing software in the world - Ignition by Inductive Automation!

The Sheer Joy of Python

I decided to take on a little project just for fun and used Python (naturally since that is Ignition's embedded "scripting" language) to do it. I decided to download the Python IDLE IDE (Integrated Development Environment) to see if I could speed development a bit. The whole download from the website and its subsequent installation only took maybe three minutes (it's free too). It took me a minute or two to figure out how to make it come up in the editor mode rather than the console mode but once I got beyond that I was amazed at how fast I could write a lot of functionality.

I'll tell you a little secret, I googled things I wanted to do and then cut and paste example code into the editor. Then I made a few obvious changes and bingo, it just worked! Then I cut and paste that code into Ignition and it worked.

It became immediately obvious to me that I could even write drivers this way in a pinch. This wouldn't be the recommended way because we have a Java API for third-party developers that would be better integrated. But in a pinch where you need something quick and particularly for simple one-off protocols this would be a good (and fun) choice.

Python is forgiving and intuitive. It has dynamic type casting so you just code away and don't worry about that. The language is easy to read so when you look at another person's code you usually can tell exactly what's being done. But don't be fooled by this ease of use because Python is fully object oriented and in the case of the flavor we use in Ignition (Jython), can drill right down into the Java code. There is no compiling either, just run the code.

I mentioned all this to some of our developers yesterday and they lit up. They reminisced at programming when they were just kids and the sheer joy it brought to them. They said that is what Python does for them now. You can do so much, so fast, totally hassle free. In fact, one of them uses Python for all types of quick tasks that would otherwise be tedious.

I realized that this is what I experienced as well, the sheer joy of programming in Python.

1 comment:

Carl.Gould said...

This is actually a pretty common reaction to learning Python! The phenomenon even has its own XKCD comic: