Artful Computing

Python

Python is the scripting language that I wish I had met before I encountered Perl. Not only does it do pretty much everything that is possible with Perl, it does so with an elegant syntax that in my opinion favours the production of understandable code. It is no surprise that the people behind both the Raspberry Pi and the BBC Microbit provide support for the Python language.

Python is probably one of the best languages in which to start learning programming. It has particular advantages for scientists and mathematicians because there are extensive libraries that do many useful jobs within these domains.

I particularly like the direct support for high-level computing concepts such as associative arrays (often known as "hashes"). If you learn to think about program design in these terms you will become a much more efficient programmer. Even when working in other languages that do not support such concepts directly, I find that the same concepts are clearly apparent in my code and provide a coherence and a key to understanding the algorithms that make for more reliable software.

I suspect that we are going to see a fair amount of the BBC Microbit in creative computing, probably starting in schools but emerging with the current generation of students into installation art. Maybe worth finding out a bit more....

Python is now widely taught in schools and universities. For the reasons discussed above this is a good idea. It also means that the community of Python users is steadily growing and it now appears in job adverts almost as frequently as C++ and Java. 

Python is probably the best language for medium scale data handling in science and engineering. Its principle advantage is the extensive set of numerical and scientific libraries. Although the computational speed is lower than that of a compile language, such as Fortran, taken overall it is an efficient method of producing results. Here, one has to consider the total time taken to develop, debug and test a data handling program, as well as the time taken to process the data. Unless a program is to be employed in a production route with very heavy usage the development time often dominates, and by choosing Python one normally saves a good deal more time than would be lost in additional execution time, as long as the data sets are not excessively large. (I have employed it to process millions of data items. I might think again if I had to handle billions.)

Note that there are two similar (but significantly different) versions of the Python language. Python 2 has been extensively used and there is a great deal of useful scientific software writing for this version of language and not yet ported to version 3.

Python version 3 is the language as it should have been designed in the first place.  This is to say, it is more soundly based on coherent principles of computer science. This is the version normally used in education. In truth, the differences are sufficiently small that with a little care it is often possible to write programs that run similarly with both versions of the interpreter - but most likely (in my experience) you introduce small incompatibilities, which are nevertheless easy to fix.

There are a great many free on-line tutorials for Python. Choose one that suits your taste. I will link here only to the "official" Python web site. Find a tutorial on the Python web site. There are a great many additional resources, such as this entirely free book and legally downloadable book by David Beasley. (Most people who do a lot of Python eventually decide that they want the hardcopy version beside their computer terminal.)

Breadcrumbs