A few more specific things python is good at:.

- Functional programming. Lambdas, passing functions as parameters.
Returning functions. Its rare to use day to day, but useful to some.
- Object oriented programming.You have classes and inheritance.
- Geospatial stuff. It seems DB2/400 has a geospatial extender, but I'm
pretty sure RPG can't manipulate shape files. At the very least, python and
the gdal modules would be a good way for doing geospatial ETL if you have
to import ESRI shapefiles.
- .quantlib is a good C++ library with python bindings for quantative
finance. If you want to calculate bond coupons and the like, that's the
- The syntax for dictionaries and arrays is very similar to how JSON
looks and there are plenty of JSON serializeers that will convert JSON to
dictionaries and arrays and visa versa. So if you need to manipulate JSON,
python is just cleaner.
- Talking to other data sources than DB2. Got a Microsoft SQL Server
Database you need to talk to? Python can do that.


On Mon, Aug 24, 2015 at 1:09 AM, John Yeung <gallium.arsenide@xxxxxxxxx>

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).

John Y.
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,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2020 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].