99 problems but Python ain't one!

grokcode

Joana Chavez

Posted on August 22, 2018

99 problems but Python ain't one!

Let's start from the very beginning, defining the different approaches of how code is finally executed. In general, when a programming language is used, two approaches are possible: either compilation or interpretation. Oh and there is also a third one which is a hybrid approach and is in between both of those said previously. Let's take a look:

  • Compilation: When compilation process is done, what is done is a executable code obtained from the whole code, so from all the source code what is obtained is a executable that can be used as it is and that has the same characteristics needed by the machine. (Let's say an example would be Java, which through compilation it can be run over the JVM) The guy in charge here to do this job is the compiler (duh! of course he is!) In the image below, we can see more in deep the whole process...

As you can see, it takes the whole thing in there and then produces the executable to be then processed.

  • Interpretation: On the other side, with interpretation we obtain let's say a "translation" of each instruction from each of the statements, so it is a job done statement by statement, that is, instruction by instruction is being interpreted by the interpreter (duh again, of course that's his name!) Languages that could be used as an example of interpretation are shell scripts, like bash for example, or Javascript, PHP, and oh! also the most important dude in this article: Python.

This process can be seen in a better explanation here:

As you can see, statement (stm for short) by statement are processed and immediately executed.

Ok but there should be a third one right? there is always something in between... and yes there exists also a third approach that uses a combination of both approaches and it is for intermediate languages, we can see it in the following image:

In this last one, the compilation is done up to an intermediate language and then using the executor which is no more than an interpreter like the one used in the interpretation process, we can say that is an approach in the middle (has some features from compilation and some from interpretation)

Okay, but going back to the idea of why Python is so cool? I mean, it is widely used in the areas like Bioinformatics, Data Science and so on, and the reason is because of many reasons like for instance:

  • Readability : It is considerably ordered, and this helps a lot for making it easier to people to read code ( even to make your code work you will need to indent everything okay before using it! )

  • Code reuse: There are many modules available to be used in Python for different purposes, that's the feature that some call "batteries included"

  • High Performance: It's very close to C, but the use of other libraries that enable an efficient computation like for example NumPy, increases much more the performance.

  • Simple: Again, and this one is also related to the first one in this list, the readability and the minimalistic characteristic it has, makes it easier to concentrate in the problem you have instead of thinking in other low-level language problems. (Like for example exceeding memory or garbage collection... who thinks of that in Python? )

  • Easy to learn: Another point for Python, the learning curve is considerably low and you'll learn very fast! As a matter of fact I think this is the one that actually is considered for Bioinformatics areas, I had colleagues in Bioengineering areas who are not used to code all the time, but this language makes it easier to get started!

  • Free and Open source: Another one yet is that it's free! so you don't have to worry about licenses and things like that, even with so many different IDEs like Spyder and package managers like Anaconda. (Another cool feature from Spyder better than the not free IDE PyCharm is that for Pycharm you don't get the coolest help inside the IDE, while with Spyder you can get to search the documentation of the code inside the IDE, how cool is that?

  • Interpreted: This one is more related to the previous we talked about the performance but it's about it.. since it's interpreted, the execution is very fast, but of course this will also depend the amount of data you're processing!

Great, so now that you got all these ideas I hope this has been an eye opener on what to expect from the language, and if you are considering on learning about it, I totally recommend it!

If you're having girl problems I feel bad for you son, I got 99 problems but Python ain't one!

💖 💪 🙅 🚩
grokcode
Joana Chavez

Posted on August 22, 2018

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related

99 problems but Python ain't one!
bioinformatics 99 problems but Python ain't one!

August 22, 2018