I’ve started using Python much more these days as I begin to switch to Tellurium as the standard modeling platform. Python is of course very popular and so I expected a very modern language which to a large degree it is. However, I’ve found, so far, two disappointing aspects which I think is related to Python’s age.
The first is that there is no way to make variables or methods in Python classes private. This is a common facility is all modern languages including some old ones such as Object Pascal. All fields in a Python class are visible. When you ask seasoned Python users you get two responses: the religious one and the practical one. The religious one says that hiding details of a class is overrated and as gentlemen we should respect the fact that some fields in a class, though accessible, should not be touched. The practical response is to add an underscore to every variable that should be private and hope that the IDE you’re using recognizes this convention and hides the field from you (likewise humans will hopefully do the same). Today we are more enlightened and recognize the virtues of Data Encapsulation.
The next problem I came across which really annoyed me since I am so used to it in other languages, is the inability to define multiple constructors. Strictly speaking there is only one constructor in Python, that strange concoction of letters, __init__.. To get round this limitation Python developers will use classmethods or go into overkill and use factory methods.
These limitations reflect to some degree the age of Python which was conceived in the late 1980s. I’ve seen the same thing in R (developed again in the late 1980s but whose origins can be traced back as far as the 1970s) where the language is even more archaic. The problem is of course, once a language becomes popular a huge investment will have been made in developing support libraries which makes it very difficult to transition to a more modern language. We’ve seen this of course in FORTAN and COBOL, both conceived in the 1950s but still used. At the moment I don’t yet see a new scripting language to replace Python but I am sure we’ll see something emerge in the next 5 to 10 years.