Considering migrating to Python from Visual Basic 6 for engineering applications
William Ray Wing
wrw at mac.com
Thu Feb 18 10:59:29 EST 2016
> On Feb 18, 2016, at 10:33 AM, wrong.address.1 at gmail.com wrote:
> torstai 18. helmikuuta 2016 17.21.32 UTC+2 Oscar Benjamin kirjoitti:
>> On 18 February 2016 at 11:32, Chris Angelico <rosuav at gmail.com> wrote:
>> It sounds to me as if all of your needs can be solved in pure Python
>> code possibly using some of the popular extension modules from PyPI.
>> In this case it's actually very easy to package/install. You can
>> package your code simply by zipping it up with a __main__.py file.
>> Someone who wants to install it will simply have a two step process:
>> first install Python (and possibly a few dependencies) and then obtain
>> the zip file with your code in it.
> This form of packing is not desirable. I can't ask other people to install Python on their machines, and I also would not want show most of the code doing the calculations.
Now things get tricky. I can understand you not wanting to force people to pre-install Python in order for your code to run, but just how deeply do you want to hide or obfuscate it? Is this potentially a commercial application to be sold, or are you simply trying to keep things clean and tidy within various divisions of your company. I’d hope not the former, because even VB can get you into tricky licensing issues (and in any case - even fully compiled code in any language these days can be de-compiled into logically correct source code, although with less than obvious variable names). At the other extreme, there are packaging programs (py2exe comes to mind, although I have no experience with it). These wrap the whole python interpreter, your code, and any needed libraries into an executable (clickable) package. Their only downside is that the output packages they produce tend to be large. However, any sophisticated user who digs into them WILL be able to find your source code, possibly only slightly obfuscated by being zipped.
> Another question I have is regarding reading numerical data from text files. Is it necessary to read one character at a time, or can one read like in Fortran and Basic (something like Input #5, X1, X2, X3)?
Python can read lines of text or whole blocks of text from source files. If those files are in more or less well-understood form (csv for example) it has libraries specifically designed for reading and extracting data from them (including VERY nice facilities for doing arithmetic and otherwise manipulating time and date data).
More information about the Python-list