class my_adventure_with_python():
By: Luís Santos
Tags: Web Framework, Python, Developer, Software Development, Programming Languages

def hello_world():

Hello everyone! My name is Luís and I’m here on a mission: to talk to you for the first time about a special programming language… the almighty Python! But before that, allow me to tell you all about my humble journey.

My first contact with the world of programming happened when I chose to enrol in the course of Technologies and Information Systems at the University of Aveiro (TSI- UA). It was a surprise for everyone because until then I was just a “normal kid” who liked to use his computer to play with friends, to start exploring social media, to do some presentations and school work. When I made this choice, despite having my future to look out for, I never knew what I was getting myself into.

def how_it_all_started():

I can tell you that in the early days, I felt that I had chosen the “wrong stone” and that I didn’t have the strength to carry it along the way. All of a sudden, this path that I chose became a challenge for me, a fresh start. It took me a while to get my head in the game but eventually, everything began to make sense when the course I got into suffered a major update and went from being TSI to Computer Engineering. This upgrade meant that we would not only learn and use Java but also learn about other languages and technologies, such as the Python programming language.

This is quite funny since my first contact with Python was in a complex subject called Inteligência Artificial (Artificial Intelligence).

It had everything to be a brain-teaser but, in a short period of time, my love for programming started blooming and my skills started to grow exponentially to the point where Python became my entry ticket to the world of work.

All of this was initially confirmed when I was invited by my bachelor’s professor advisor to apply for a research scholarship (that I actually won). In that scenario, the master’s degree in Computer Engineering was a great way for me to be able to ‘work’ and ‘study’ at the same time. In that scholarship, I worked mainly with Python and as a result, my thesis project’s core was developed in Python as well. After that, I got my first real-world job and guess what… I am a software developer in Python! :D

With this being said, what I want you to realise is that learning Python was my turning point and gave me the tools to improve my programming skills, keep growing as a developer and being able to join Ubiwhere, the company where I am currently working. Ubiwhere is a Portuguese company focused on research and development of user-centred software solutions for Smart Cities and Telecommunications. It was founded in 2007 in the wonderful and stunning city of Aveiro, Portugal.

As I mentioned before, almost all my academic and professional journey was centred around the Python language. But after all, what makes it so special (at least for me)?

def pythons_history__a_christmas_story():

It may not seem like it, but the Python language was actually created a long time ago and has gone through several versions. Let me give you a quick overview of how this amazing programming language was brought to life.

It all started way back in 1989, in one of the best months of the year — December. Yes, if it wasn’t for Christmas, Python would probably never exist. Why? Because its creator, Guido van Rossum, decided to make up a new hobby to keep himself busy during the Christmas holidays. (If you ask me, I wouldn’t let go those wonderful and peaceful days, but you know what they say — it is in the least favourable moments that the most fantastic things happen — and I agree.)

Anyway, this German gentleman decided to create an interpreter for a new scripting language based on ABC, a programming language invented by his company Centrum Wiskunde & Informatica (CWI), and he decided to call it Python (he was a big fan of Monty Python’s Flying Circus). And no, you don’t want to know what ABC is, trust me. Although he started developing it in 1989, it was only in 1991 that he published its code and Python became official, known as version 0.9.0.

I could go on and on talking about its evolution until today, but the important thing you need to know about its history is that Python was created as a tool to facilitate the development of code in opposition to the already existing languages of ​​C, C ++, among others. Python’s path was not easy but it gained more and more followers as time went by and finally “exploded” when the internet appeared in the early 2000s and version 2.0 was released. From that point, Python began to be taken seriously. The dynamic web market was its main focus and in a few years, Python web frameworks born like Django and Flask. Then the version 3.0 was released in 2008 improving the main issues, bugs and incapacities of the previous version, giving Python the tools to be even more FANTASTIC. Nowadays, Python’s last version is 3.9.0 and it promises to continue to grow and to be better and better.

def but_after_all_what_is_python():

Python is a programming language and it’s known for being a high-level language because of its syntax being directed to the end-user, which facilitates its perception and interaction. Although it uses specific and technical naming conventions, it’s objective and easy to recognize and the code is pretty understandable and concise.

It offers a structure that supports different programming paradigms (object-oriented, imperative, functional and procedural) and one of its strong suits is that the existing code in a python module can be executed without having to go through a set of manual commands to make the build process. This makes it even easier to use and increases the speed of the modules’ execution. Just code away and then run the module like python <module_name>.py and voilá! Of course, this is the most basic case, as it is possible to pass arguments on that single required command line python <module_name>.py argum.

I already mentioned its syntax and versatility, but there is something that makes Python different from other programming languages: the indentation of its code. If you are familiar with other programming languages like Java or C, the so-called code block — the code within a function, a condition, a loop, etc. — is usually defined using the so-called curly brackets “{ }”. This defines the block of code that is executed. Well, in Python it doesn’t exist. Whenever there is a need to define a block of code that has to be executed under a certain condition or instruction, it uses indentation. Below I show a small example of how indentation is used.

This process is automated by Python itself by setting the spacing equal to what the Tab key on your keyboard does. This key allows you to give the necessary spacing to the code so that everything is correctly organized, both to define a code block and to end it (Shift + Tab). In addition to this, there are numerous extensions that can be used to help to organize your code and with indentation. I use Visual Studio Code to program (and I highly recommend it) and this editor allows you to install extensions directly from its interface but, in case you don’t use it, you can simply install the extension. For this, you need to have the pip installed. It is a package management system that allows you to install packages for Python. Usually, when installing Python on your PC, pip comes in the package, making this process easier. Once you have the pip, you only need to do pip install <package_name>. To format the code, I personally like to use the black package and flake8 for linting but feel free to find the libraries that best fit your programming style. Attention, these are not mandatory but they give a nice upgrade both in terms of speed and flow for developing code. Believe me, if it’s a big project, it will definitely help!

I could go into more basic and generic details here but if you’re already familiar with the world of programming, you know that the pillars of it are ruled by the use of variables, functions and operations. In Python’s case, its use is, once again, quite simple and objective. If you really want to learn Python, I advise you to improve your knowledge and perception of what is possible to do by reading the following document: https://python101.pythonlibrary.org/.

def python_frameworks():

As I mentioned before, Python is widely used in web programming. To improve their development, developers use web frameworks. What are web frameworks, may you ask? Web frameworks are a set of modules or packages that provide the necessary tools for better and faster development of platforms and web applications.

django, flask and tornado — three examples of python frameworks

In this case, there are three types of frameworks:

full-stack frameworks: they are the most popular among developers (and include my favourite framework — Django ). As the name implies, these types of frameworks are used for solutions where you want to group all the components of an application in one project. The aforementioned Django contains the elements organized in order to provide its users with rapid development and execution of their application. It contains three layers of distinct components that form the Model View Template (MVT) standard. With this architecture, it is possible to manage a number of things, from databases to the templates, having all the inherent logic in the middle. It is currently in version 3.1.3 and it already has projections for the release of version 5.0 for the beginning of 2024;

they are the most popular among developers (and include my favourite framework — ). As the name implies, these types of frameworks are used for solutions where you want to group all the components of an application in one project. The aforementioned Django contains the elements organized in order to provide its users with rapid development and execution of their application. It contains three layers of distinct components that form the Model View Template (MVT) standard. With this architecture, it is possible to manage a number of things, from databases to the templates, having all the inherent logic in the middle. It is currently in version 3.1.3 and it already has projections for the release of version 5.0 for the beginning of 2024; micro frameworks: these types of frameworks are perfect for small/medium projects as they do not provide additional functionality like the aforementioned full-stack. By being simpler, they “pay off” in extensibility, as they do not contain requirements for additional software components and, at the same time, allow the developers to add the features they want. For this type of framework, my example is the popular Flask . It supports several extensions and although it does not contain additional software components, some essential dependencies for security, agility and ease of development are already included in its installation;

these types of frameworks are perfect for small/medium projects as they do not provide additional functionality like the aforementioned full-stack. By being simpler, they “pay off” in extensibility, as they do not contain requirements for additional software components and, at the same time, allow the developers to add the features they want. For this type of framework, my example is the popular . It supports several extensions and although it does not contain additional software components, some essential dependencies for security, agility and ease of development are already included in its installation; asynchronous frameworks: with new Python versions being released, this type of frameworks started to gain more popularity. It’s actually Python 3.5 version’s fault since it was the first version to include the asyncio library. Through the async and await methods, this allows a better performance of web applications for scenarios where it is necessary to manage several concurrent connections. If you want to have a more detailed look into this type of frameworks, I recommend Tornado or Sanic.

Considering what has been explained above, the use of this type of frameworks is a great asset to the development of a project. In addition to being open-source, they are easy to integrate, efficient, secure and generally have good documentation which is halfway to being able to develop an efficient solution more quickly.

def the_future_of_python__what_can_we_expect():

We never know what the future holds. The pandemic took us by surprise and reminded us that nothing and nobody is free from finding a few bumps in the road. But as someone once said, after the storm comes the calm. And the programming world is no exception.

Software development companies have been able to stand their ground during this pandemic, continuing to grow and innovate. When it comes to the Python language, many companies ask for it as a requirement and the trend is for that to continue to increase.

In the following chart, generated by the Stack Overflow, we can see the increasing growth of questions related to Python and that reflects its large-scale use, leaving all other languages far behind.

This chart also tells us, indirectly, that this language still has a lot to grow and improve. New programming languages are appearing with features that may shake the bright future that was predestined. For example, mobile development in Python is still very “green” and needs to be revised and upgraded. It’s clearly behind in this area. Its performance, in general, is also not very appealing and falls slightly behind the others. These and other details may or may not dictate Python’s supremacy but for now, it is certainly a valid option and opens up many opportunities in the world of work. In fact, I owe it one for that.

def summary():

So there you go… my first Medium story, also known as your favourite article! 😁 If you still have any doubts about why you should use or try this amazing programming language, take a look at what people call The Zen of Python and draw your own conclusions.

What we talked about in this article is just the tip of the iceberg but I sure hope it was enough to captivate your attention and to encourage you to research more about this language, that has given me so many opportunities (and I wish the same to you).

To finish off on a great note, I want to amuse you with a simple module that will captivate you and show you that programming can be quite fun and abstract! Just run the code and play with it 🚀

def references():

https://www.geeksforgeeks.org/history-of-python/

https://wiki.python.org/

https://wiki.python.org/moin/WebFrameworks

https://geekflare.com/python-asynchronous-web-frameworks/