Considering migrating to Python from Visual Basic 6 for engineering applications

William Ray Wing wrw at mac.com
Wed Feb 17 16:27:59 EST 2016


> On Feb 17, 2016, at 2:49 PM, wrong.address.1 at gmail.com wrote:
> 
> I am mostly getting positive feedback for Python.
> 

I would be surprised if you weren’t.

> It seems Python is used more for web based applications. Is it equally fine for creating stand-alone *.exe's? Can the same code be compiled to run on Linux or Android or web-based?
> 

I’m not sure where you got that idea.  Python has been and is being used for an extremely broad range of applications.  At one extreme, the popular YouTube site is based on Python (and yes, that is a web application), at the other extreme much (most?) of the data analysis of the recent LIGO data leading up to the discovery of gravitational waves was done in Python, and numpy (a python numerical library); with the results displayed in matplotlib (a python library for scientific-engineering graphics).

The basic python language and its libraries are completely cross-platform (Linux, OS-X, Windows, iOS, and Android).  The same source code will run on all of them.  However, because it is an Interpreted language, the step to a bundled, self-contained image is platform dependent. There python compliers (as opposed to interpreters) for some, but not all platforms, and there is a very active JiT compiler project that would fall somewhere in between. 

> Is it possible to create GUI elements with a good IDE? Can they be defined like in Visual Basic with given sizes, fonts, visible/invisible, etc.?
> 

There are several GUI libraries for Python.  You might check out TK (which comes built-in), but there are also libraries like wxPython, Kivi (which is completely cross platform), and PyQt.  Note that these are the GUI libraries themselves, not IDE’s which tend to be independent.  There are too many IDE’s to list here - check with Google.

> Is it easy to do matrix operations in Python? Or do I need to write subroutines like in Visual Basic?

Matrix (and similar operations) can be done in Python directly, but if you need maximum performance you should use the optimized vector routines available in numpy, these are typically pre-compiled with C or FORTRAN and squeeze out the maximum speed your hardware is capable of.  (There is work being done to migrate them to GPUs, but is VERY hardware dependent at this point.) If you need to do scientific/engineering analysis, you should also check out scipy, which is built on top of it and is also vector optimized.

> 
> Could someone kindly tell me advantages and disadvantages of Python?

If you are completely satisfied with VB, there is no reason to change (other than the enjoyable exercise of learning a new and more powerful language).

On the other hand, Python has often been referred to as “executable pseudo code” - in other words, the english-like steps you might sketch out to outline the solution to a programming problem in another language is to all intents and purposes Python itself.  This makes for very fast and productive code generation with typically fewer errors than are made in other languages. In addition, and as has been implied above, it is cross platform.  The same python source code (with the appropriate libraries) will run on all the platforms mentioned above. One of the biggest productive features of Python is the fact that it is interpreted (in its most common instantiation).  Thus, you can have two windows open side by side, with the source code in one and running code in the other.  Changes in the source code can instantly be reflected in the output.

> Or any better options? I have like 40-50 VB Forms and may be around 20000 lines of code. It will be a task to learn a new language and translate/re-write that code.
> 

Not necessarily better, but at least worth looking into would be the Swift language, which shares much of Python’s modern structure, is now also open source, and has been ported to most flavors of Linux.  A Window’s port is promised, but I don’t know how far along it is.  It *is* a compiled language, so you would then be back in the edit, compile, link, and run loop as you debug your code.

I’m sure you will get lots of other answers - Google each of the things I’ve mentioned and you will get a truck-load of info.  You might start with Wikipedia and read there about Python and Swift.

> Thanks for your responses. 
> -- 
> https://mail.python.org/mailman/listinfo/python-list




More information about the Python-list mailing list