Python, programmer’s Swiss knife
(appeared in May 2018)

(link to main website)

Software geeks who develop programming languages are not known for imagination in naming their creations, says S.Ananthanarayanan.

One of the earliest of modern computer languages, developed in the 1960s, was called Basic Combined Programming Language, or BCPL. The name came from its predecessor, CPL, for Cambridge Programming Language, which had been renamed Combined Programming Language.

Ken Thompson and Dennis Ritchie, pioneers of computer languages, modified BCPL to better suit its purposes and they named the new language, simply, ‘B language’. These computer languages were the first ‘higher level’ interfaces between programmers and the raw circuitry of the machine, and specific languages were written for different machines. Dennis Ritchie then modified ‘B language’ to create a versatile language that could easily be adapted to different machine architectures. As this language came after ‘B’, Ritchie, in keeping with creativity in naming computer languages, named the new language ‘C’.

Other popular computer languages, FORTRAN and COBOL, are application specific acronyms – for Formula Translator and Common Business Oriented Language. The important development after C, the ‘object oriented’ improvement, was C++, and this name deserves credit, as it is ‘one more than C’ and it adds to ‘C’ the C language code of ‘++’, for’ increment by 1’. And then, the next step after C++ is Java, which gets its name from the ‘endless cups of Java’ that were consumed when the language was developed.

In this context, a computer language known as Python may stake a claim to be descriptive or evocative. But no, the language has nothing to do with serpents, its author, Guido van Rossum, was at a loss and he simply used the name of, ‘Monty Python’s Flying Circus’, a favourite BBC comedy show! But crises in finding names apart, computer languages have developed side by side with expanding applications and growing capability of computers.

There has been tremendous growth in computer languages and great IT support is now available for data collection, computation, data analysis and data representation. The resources, however, are spread out and specialized, as opposed to versatile. As applications need a brace of technologies, programmers need the skills to work with work with many software packages. This where the Python language steps in, as a compact, user-friendly suite that brings together the tools and philosophy of different platforms. Python has hence found a wide field of application - “from testing microchips at Intel, to powering Instagram, to building video games”, as one commentator says. In the university and the lab too, Python has become a handy computation and display aid for the scientist, the engineer and the student.

A special feature of Python code, which is what a programmer writes, or would reside in a device, is that it is economical, even brief. But the code is powerful, because it is a great store of domain-specific ‘libraries’ that the short lines of code invoke. As an ‘open source’ programming language, contributions in the form of code are added by programmers worldwide. Over the last twenty years that Python has been around, libraries and Python frameworks have grown, to provide eye-catching graphical displays for different fields of work, like earth sciences, astronomy and game and web development

Getting a grip on Python, however, has not been easy, as it takes a degree of familiarity with several languages. The Princeton University Press has stepped in to supply the need with a new edition of ‘A student’s guide to Python for physical modeling’. The authors are. The book, by Jesse M Kinder, assistant professor of physics at the Oregon Institute of Technology and Philip Nelson, professor of physics at the University of Pennsylvania, assumes little prior knowledge of programming and is addressed to undergraduates or any motivated reader.

Computers and software

The working of a computer is little more than storage of a ‘0’ or a ‘1’ at a place in its ‘memory’ and then manipulating the values, using just a few basic arithmetic operations that the electronics in the computer can carry out. For instance, adding a ‘0’ to a number does not change the number, but adding a ‘1’ causes either a ‘0’ to be replaced by ‘1’, or for a ‘1’ to be replaced by a ‘0’, with a ‘1’ ‘carried over (counting in ‘0’s and ‘1’s is ‘binary’ arithmetic, or a form of arithmetic where ‘2’ takes the place of ‘10’ in our usual, ‘decimal’ arithmetic. Thus, when ‘1’ is added to ‘1’, the answer, ‘2’ and it is written as ‘10’)

The early computer languages were just methods to communicate with the computer to place values in memory locations, retrieve the values, carry out operations and then store results. The early programs, which were written in ‘machine language’ were thus in symbols which translated into electric signals that the computer could take and respond by storing, character by character, the symbols that followed, etc. And there was a sequence of symbols for each step in the computation process.

An advance was the ‘assembly level’ language, which used ‘human’ words’, like ‘read’ or write’ to take the place of machine language code. There still was, however, one assembly level command for each machine language command, although there were the ‘macros’, which combined more than one of some assembly level commands, to make things easier. The more versatile, ‘higher level’ languages were in fact programs like these, but they defined a grammar. These languages defined classes of values, ‘integer’ or ‘character’ (which automated the storage space to be reserved), for instance. This enabled the user to use easy syntax of values and commands, while the task of writing out the assembler or machine code was done by a ‘compiler’ program. Much of the detailed, machine specific housekeeping, managing the memory, and later the display, was also taken over by another program, the ‘operating system’. Programming languages were then created to speak to the operating system and the user’s job was greatly simplified.

Languages then grew, to have the capability of creating user defined ‘functions’, or new ‘macros’, which could be readily invoked carryout a complex computation or tabulation. Similar functions were built into the language, to take control of the display, to create text boxes or spaces where a user could be invited to enter data, to make connection over a network and so on. As the use of IT grew and large programs were written, there arose the need for the language to help create error-free programs and to make use of functions that were written by other programmers and available in a separate folder, or even over the Internet.

There was a progression, with the first programming languages being ‘procedural’ and then ‘structured’. But with growing complexity, there arose the need for greater abstraction and to view procedures as interactions between isolated and protected entities known as ‘objects’. This was a powerful innovation, where objects and generations of objects, had specific properties and means of communication. The concept made for libraries of objects of different kinds, built in with properties and methods, optimized and tested, which could be invoked and adapted, for very fast software development.

The Python language incorporates these features and the programmer gets access to a universe of specialized tools, which he or she can adapt. And the student’s guide from Princeton University Press, systematically and rapidly, hand-holds a novice through the basics, mathematical computation and generating 3D models and displays.

------------------------------------------------------------------------------------------
Do respond to : response@simplescience.in