According to the Python Institute, “Python is a widely-used, interpreted, object-oriented, and high-level programming language with dynamic semantics, used for general-purpose programming.” In other terms, Python is a very popular programming language, it is also an interpreted language, meaning that the code does not need to be compiled in advance for the target system, but is rather translated by an interpreter as it runs. To make this concept even clearer, imagine you are a tourist in a foreign country and the only directions to a highly sought-after tourist attraction site are written in a foreign language. You ask the hotel assistant who understands English to translate all the directions in advance into English so that you can follow along on your own; a compiled language works in a similar way, but it takes time to compile the code for the target machine before it can be executed. If changes are needed, then you have to recompile for the changes to take effect. Examples of compiled programming languages are C++, C, COBOL and GO. On the other hand, an interpreted language works slightly differently. If we use the same analogy of a tourist in a foreign country, the tourist in this case pays the hotel assistant to go with them and asks the assistant to translate each instruction as they drive to the tourist attraction instead of in advance. The interpreter translates one line at a time into the target system’s language.
Under what circumstances would an interpreted language be preferred over a compiled programming language? Well in this case, there happens to be an interpreter for a number of target systems, so that you can write the code once and run it on any system for which an interpreter exists, such as Windows, Linux, iOS, and many more. Whereas, for a compiled language, the code can only run for a system for which it has been compiled for. Examples of other interpreted programming languages are JavaScript, PHP and Perl.
The other characteristic of Python is that it is an object-oriented language, meaning that in Python everything is an object, just like in the real world. A good example would be defining an object called Person; a person has characteristics and abilities. The person could have height, skin colour, age, gender, a name and surname. The person will also have abilities, like walking, talking, and eating. Characteristics or variables of an object in Python are called attributes and abilities or functions are called methods. Because of this object-oriented nature of Python, it is much more convenient to convey ideas and concepts from the real world into Python code and thus much simpler to solve problems.
Python is also dynamically typed, that is, you do not have to declare variable types in your code, Python will automatically pick up the type of object it is at runtime. For example, if a person’s age is a number or integer, you do not have to tell Python that it is a number because as soon as you assign a number, Python treats that variable as a number. In contrast to dynamically typed languages, statically typed languages, like C++, need the variable type to be declared in advance before compilation, and checks are done during compilation to ensure that object type rules are not violated. It tends to be quicker to code in a dynamically typed language when the programmer does not need to explicitly declare types. However, the advantage of statically typed languages is that more errors are caught during compile time rather than during runtime.
Being a high-level programming language, means Python is highly abstracted from the computer’s natural language, being 1s and 0s. This allows a programmer to use close-to-English instructions to create a computer program that a compiler will translate to computer low-level instructions. This characteristic allows Python to be object-oriented, dynamically typed, and even have automatic memory management features, therefore making it even easier to program using the language. Coding in a high-level language takes a fraction of the time it takes to program in a low-level language, and coding in a low-level language can be quite cumbersome and error prone, therefore high-level programming languages are good enough for general-purpose programming. However, device manufacturers, operating systems designers, and compiler designers have to be proficient in low-level programming because of their software’s proximity to the machine.
Python was conceptualized and developed by Guido van Rossum, a programmer who worked for Centrum voor Wiskunde en Informatica (CWI) in the 1980s. At the time, they were using a language called ABC, which was a simpler language and easier for beginners to pick up, yet Guido van Rossum felt there were many areas that could be improved upon for the language. So, in the Christmas week of 1989, Guido van Rossum, started a project to keep himself busy, the goal was to create a language that would have the best parts of ABC and add more features to create a better language. Since he was a big fan of the BBC television comedy show called “Monty Python’s Flying Circus”, he decided to call the project “Python”, and the rest is history.
Python has come a long way since the first version was released in 1991. The language is popular than ever, and it has not shown a sign of slowing down, especially in the data science community. Some coders might be puzzled why Python is used so much despite being slower than programming languages such as C++ or Java. The simple fact of the matter is that users can barely notice the slowness of Python because it is fractional, and the benefits outweigh the slowness. The fact that writing a Python program takes fewer lines of code to achieve the same results as multiple lines of code in C++ and that it is closer to writing English and that it is a dynamically typed language, places Python as a clear winner in terms of productivity and ease of use. Moreover, computers have become less expensive and faster than when Python first came out, and therefore Python code can execute faster. For business users the time it takes to develop a program in a much more complex programming language might be more costly than using Python to get the same results at a fraction of the time. Therefore, Python fares well in quick prototyping applications and general-purpose business applications. If high performance is a strict requirement, such as game development, languages such as C# and C++ would be more appropriate than Python. Python is very popular for many of the reasons that have been mentioned already, but it is particularly popular in data science, not just because of the ease of use, but the language has a huge developer community that is always eager to assist in answering questions and assist beginners and experienced programmers alike. Python is also open source, which means its source code is open for anyone to inspect and participate in developing. Python is also extendable using modules or python packages and frameworks that have been developed by the community to offer more functionality. It just so happens that there is a considerable number of packages that have already been developed for data science and machine learning that it makes it easier for data scientists to turn to Python for data exploration and analysis. Artificial Intelligence and Machine Learning are increasingly being adopted by many businesses and this has driven up the demand for Python development skills and academic institutions are adopting it as a means of teaching beginners how to program, further fuelling the popularity of the language. Besides the language called R, you would be hard-pressed to find a data scientist that cannot code in Python.
0 Comments