I have provided information about this topic so many times that I'm
really afraid of beating the very dead horse to a pulp.
But it's not often that someone asks this directly; I have usually
thrown Python comments into the conversation where I felt it would be
a good fit for some other problem, particularly a problem that is not
handled that well by RPG.
First, I'll say that Python doesn't offer much advantage for doing
things that RPG handles well already. Also, Python cannot be compiled
into ILE modules and cannot use display files. (There was an attempt
to bring Dynamic Screen Manager to iSeriesPython many years ago, and I
think it actually even worked, but it was not updated for the latest
versions of Python.)
But Python does have many advantages over RPG. Some come from the
nature of the Python language itself; others come from the extensive
standard library that comes with Python and the even more extensive
ecosystem of third-party libraries available for Python.
Some things that the Python language is much better at than RPG:
dynamically sized data structures (that is, the size can grow or
shrink during run-time, and you don't know the maximum size
beforehand); nested data structures (such as arrays within arrays
within arrays, or arbitrary structures whose members are other
arbitrary structures, including arrays); string handling; regular
expressions; anything object-oriented; anything relating to IFS stream
files. I find that Python's data structures and dynamic nature make it
an extremely good fit for interfacing with SQL. You can use embedded
SQL in RPG, but it's not as convenient as doing it in Python.
The Python standard library has modules for reading and writing CSVs;
socket programming; multiprocessing; e-mail; XML processing; random
numbers; exact fractions (building on the fact that Python's integers
are arbitrary-precision); common scientific math functions, including
complex numbers; file and directory comparison tools. The list goes
on. It's kind of amazing what's included. And that's before you even
start to explore third-party packages.
Python is a very popular server-side Web development language. It has
a number of good Web frameworks, the biggest and most capable being
Django. Other common tasks of interest that are handled well by
third-party Python libraries are working with Excel files and PDFs.
If you are familiar with Java, a nice shortcut to explaining Python's
advantages is to say that Python can do pretty much anything Java can,
and doing it in Python tends to be easier than doing it in Java. (In
other words, where Java has an advantage over RPG, Python has the same
advantage that Java does, only Python's is sometimes even greater.)
As far as what applications you can use Python for, it's basically
any. As mentioned before, you can't easily use Python to do
green-screen 5250 displays, but anything else you might use RPG for,
you can also use Python for.
I hope that answers the question(s).
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives