Python Introduction- for data practitioners

Python Introduction- for data practitioners

Well Python comes in handy for an array of use cases across web development, data science, machine learning, artificial intelligence, and software development.

If you are reading this, your only purpose should be to understand how's Python useful to a data engineer?

First things first- forget all list of subjects and use cases where python can be used. Why boast? In fact, a lot of other programming languages can also come in handy, once the barrier to solving use cases by employing them is lowered. How? of course by building and maintaining libraries. Here, Python wins it all- most exhaustive libraries when it comes to doing something out of data!

Think of programming languages as business analysts, they help connect, write, compile, interpret a friendly version of instructional rule-based writing on our machines, and make them do all the worldly helpful stuff that we want as outcomes- those can be serving web pages to creating games.

Hope we had a comfortable start!

Now, from the perspective of a data practitioner,
(note: you will notice I use the word practitioner, it's not a fancier version of engineering but it encompasses the practice of design, implementation of robust data driven systems)
Python is like the bread and butter of data engineers, we just can't do without it. Well, we can, after all we humans created Python, the programming language- but come to think of it when this language has been in use for enough number of years, and is robust, they why worry reinventing the wheel?

Python has a neck deep presence across use cases within the data sphere. Starting from data collection, processing/cleaning, analysing/exploring, visualising, machine learning, artificial intelligence...

okk take a breather,

.. what else? parallel processing, distributed computing, data storage, data management, intelligence distribution via multiple channels (like pdf, web report, email automation etc).

Yeah! all that you can think of, literally!

How does Python run?

alright, lets break what we call RUN into steps,

  1. Parse : the first step is to check if there are any mistakes in the language we have written. Because if there is- then no need to move ahead with the next step. Here, you'll see the SyntaxError exception.

    Nothing fancy, it means your language is gibberish at a certain line and position of text entered - that's it.

    At this step, the code is converted to AST. or Abstract Syntax Tree. Now what is this? simply put its a tree structure that abstracts away your code written as text into a syntactic structure i.e. a logical representation of relationships. This helps Python in reviewing semantic correctness
  2. Compile : This is where Python does its job of converting the text or code i.e. the High level language to bytecode which is friendly not to us but your python vm. The .py file is converted to one with a .pyc extension
  3. Interpret : the PVM or Python Virtual Machine converts the bytecode into lowest level set of instructions that our machine can understand
  4. Execute : execution that's it- what more fancy can it get at every step?!

    Basically as each bytecode instruction is interpreted, the program is finally being executed. In this process, there are expressions evaluated, statements carried out, objects created and functions called, ...and what not! It's your code, do anything you would like to.

Then Python finally runs your program, rapidly flicking its tongue in and out, while printing outcomes or jobs statuses on our screen along the way!

Why do we need a bytecode? is it of any help?

yes it is!
to ensure the .pyc file can be run on a machine with any processor architecture no matter the operating system it is using. For example, If someone has written say a library specific to windows utility, the moment we have its .pyc equivalent- it can be run on even a linux or macOS. There's no need to recompile any longer while changing systems/machines.

this is why we call Python an "interpreted language"- the compilation to bytecode happens automatically, and the PVM (python virtual machine) interprets this bytecode at runtime.

What's Next?

We will uncover a plethora of fundamentals, without making it wordy!
Just stick around, and definitely subscribe if you haven't yet..