Python Tutorials – Introduction & Architecture

In this section of this tutorial, we will learn about Python History, It’s Architecture and it’s properties.

Python is an interpreted high-level general-purpose programming language.

Python is mainly designed with the concept of code readability and ease of use.


Python was created in December 1989 by Guido van Rossum.

Guido van Rossum was working on an OS development project named Amoeba. This OS was intended to make a network of computers as a single computer using a distributed kernel.

They had to write utility programs for this OS in C. But it was very time taking process.

At that time programmers were tired of writing C programs or Unix shell programs.

Guido van Rossum started a hobby project of creating a new programming language at December holidays of 1989. He named that project as Python inspired from a TV show “Monty Python’s Flying Circus”.

After 3 months of his work, even though Python was not yet fully grown to use in place of C, the language was very liked by the programmers in his office. Also, they started using Python as it was fun and increased the productivity.

 After 1 year Python was released as open source.

The first version of Python came out in February 1991.

Python 2.0 was released on 2000 and Python 3 was released in 2008 with major changes in the language.

Python 3 is not completely backward-compatible. Even the print statement’s syntax was changed.

Current stable release is 3.9 but I use 3.7 as of now.

Python Architecture:

Python is an Interpreted Language where interpretation is different from compilation.

Before understanding compilation and interpretation we need to know what is Machine code and Byte code.

What is Machine Code and Byte Code?

Machines can understand only the binary representation which is 1’s and 0’s.

Our source codes cannot be recognized by computers.

For this, we need to convert our human readable source code to machine readable machine code.

Machine code is a binary representation of the computer program which can be directly run by the computer.

Lets see an interesting real-time example:

If you are having a book written in other languages than your native language, then a translator translates that book to your native language.

Other language book -> human translator -> Native language book

Languages C, C++ are compiled and compiler converts the source code to machine code which is a binary representation.

So the problem of converting the high level language to low level is solved right?

Yes! But we have an another problem.

For exam, the language C converts the source code to machine code. But the machine code is dependent on the platform in which it is created.

i.e., For each platform the machine code differs. The machine code of 2 different OS will not be same.

So we cannot run the windows compiled C program (i.e., the machine code) on Linux.

In order to run your same C program in Linux, you will need a Linux machine and compile the program in it. This will generate a machine code for Linux and then you can run it in a Linux machine.

Basically C provide a level of flexibility for platform independent. But it is not fully independent.

Due to this we a common intermediate code that can run on any platform without compile it again.

Byte code is an intermediate code for which we need a separate processor like virtual machine (ex. JVM).

Initially, the program will be compiled as usual but it generates a common byte code. This is not same as machine code . However at this stage we have completed the compilation process. The code will not be human readable.

Then what is this for, neither machine nor human can read.

The main problem in C compiler is it can generate machine code only for its platform.

So we need a separate processor which will be installed/enabled in OS. This processor will take care of executing the byte code and convert it to the OS dependent machine code in which it is installed. Then this machine code will run in the OS.

This processor is called Virtual Machine.

Java uses this technique to make it Platform Independent.

Difference Between Compilation and Interpretation:

What is compilation?

In Code compilation, the source code is first converted into a machine code/byte code which is a low-level code understandable only by machines.

In this compilation state the errors will be escalated and the compilation will be aborted if any. If no errors compilation completed successfully and byte code or machine code is created. This machine code will be run by the machines.

What is an interpreted Language?

In interpreted language the entire code will not be compiled in one run.

Each instruction will be validated by syntax checker and some other translations for data types will be done at first level. Then the result will be compiled to byte code or machine code. And then a virtual machine will be used to run in case of byte code.

Python is an interpreted language.

It is parsed through the syntax checker and translator and then its compiler converts the source code to byte code and finally Python Virtual Machine (PVM) will convert the byte code to machine code.

Figure 2: Python Architecture; Image by Author

6 Things to know about Python:

Figure 1: Python Advantages; Image by Author

Advantages of Python:

⭕️ Python gives programmer a freedom to use the variables without mentioning the Datatype. The translator inside the python interpreter will convert it to appropriate datatype. This process is called Dynamic Typic.

But due to this there is an extra step in compilation process which makes python slower than statically typed languages.

⭕️ As Python has a virtual machine, it will convert the byte code to the corresponding machine code at runtime. The compiled Python code can run in any platform. So, it is Platform Independent.

⭕️ Some people think that Python itself is a data science.

No. Its just a general-purpose programming language.

It has so many Libraries, you can call it as a chunk of code or collection of modules, which can be downloaded, installed whenever it is needed.

For example, if we need to work on web scrapping then we can use the library “BeautifulSoup”. This library parses the HTML documents gracefully and it is easy to use than implementing our own loops and string manipulations to search the HTML elements.

⭕️ As Python is an Interpreted Language, it can function any type as procedural or functional or Object-Oriented Language.

Yes! Python has class and object concept so that it can used in bigger projects and it will provide a clear structure to the project. There are various IDEs which can be used. Example: PyCharm from JetBrains community.

As it is procedural/Functional, we can use Python for experimental purpose. In that case you do not need to bother about the file structure, classes and objects and other project related components.

Write a line of code. In command prompt, just an enter does the magic.

You do not need to declare a class and declare variables.

It is an Interactive Language: As it answers immediately for each step, you can interact with the python interpreter directly.

⭕️ Easy to Learn: One more important and interesting thing about Python is its simple Syntax.

⭕️ While working on Python, you can get a lot of community support from internet as it’s been there for long enough and so many people are using it. Example: Stackoverflow.

So, that’s all about Python and now we will move on to the real coding part.

Default image
Asha Ponraj

Data science and Machine Learning enthusiast | Software Developer | Blog Writter

Articles: 84

Leave a Reply