× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



On Thu, Oct 22, 2015 at 3:04 PM, <darren@xxxxxxxxx> wrote:
I'm curious on the Python thing. I've not really dug into it, and I'm
wondering if its worth it. What limited examples I saw, were of generating
an Excel file from basically a file dump not much different than generating
a .csv. The example used some command line script to accomplish this.

Well, the point of examples like that is to show that *if* all you're
looking for is something quick and simple, it's easy to do with
Python, without a lot of scaffolding or boilerplate or setup. If you
think those examples are about as easy as generating a CSV, then it's
like getting an almost free upgrade to .xlsx. A lot of commercial
tools (not based on Python) are even specifically designed to work
that way: simplest possible dump from database file or table into
Excel.

I assume more advanced functions are available in Python, otherwise it
wouldn't be necessary, so is the entire report logic being done in Python.
We're doing things like colored column headers, conditional formatting,
formulas, break logic with subtotals, and most recently tables. Do you do
all of that along with the report logic in Python instead of RPG?

Well, like most languages, there's no *built-in* support for .xlsx
files at all. With Java you've got POI. With Python, you've got
XlsxWriter (which is what I use) or OpenPyXL. But yes, those packages
are full-featured and provide a high-level, easy-to-use interface for
the application programmer.

I do have several projects on the i that are implemented completely in
Python: accessing the database, doing any kind of intermediate
processing, generating advanced Excel output, and e-mailing the
workbook as an attachment. All of the Excel stuff you describe is
supported by XlsxWriter.

Accessing the database and doing "report logic" is actually especially
convenient in Python. The Python I use, iSeriesPython, is equally
adept at RLA and SQL, so it does a nice job of replacing RPG in all
phases. I haven't used IBM's Python for PASE, so I can't say whether
that's *as* convenient as iSeriesPython. (It will come down to how
nice the i-specific toolkits are that IBM provides.)

You asked if it was "worth it". Obviously that was at least partially
rhetorical and partially subjective. But I can give some thoughts
anyway: I would say that if you already have an established
infrastructure for doing your reports and getting them into Excel, and
that's working well for you, then getting into Python solely as a
replacement for that is most likely not worth it. I mean, it *might*
be worth it, because I do firmly believe that a fluent Python
programmer can build a working Python+XlsxWriter project faster than a
fluent RPG programmer building the equivalent project with RPG+POI.
But no matter how easy it is to learn Python, there's still some
learning involved, whereas your existing stuff already works and you
already have expertise in it.

You'll notice I usually chime in with my Python pitch when someone is
just starting out with POI, or is having difficulties with POI, not
when they're already humming along with POI.

For shops where RPG+POI is already well established, there is still
some potential value to be had with Python, because Python is such a
versatile language and ecosystem. It's not a huge exaggeration to say
"anything Java can do, Python can do better". Also, I'm someone who
believes that learning almost anything is a good thing. Learning a new
language can open up new ways of thinking, and can potentially improve
your programming in general.

And to be completely honest, I just find Python plain old fun. It is a
hoot of a language. When I first stumbled upon it, it was week after
week of being blown away by how easy and powerful it was. Being blown
away with what was already in the standard library. The feeling was
like driving station wagons your whole life and suddenly being handed
the keys to a slinky sports car. (Upgraded by James Bond's Q.)

John Y.

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

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

This mailing list archive is Copyright 1997-2024 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].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.