Grouping Environment Variables in Django

Oftentimes values in settings.py are provided using environment variables. This is one of the easiest ways to do it. However it’s easy to misuse it, and variables get scattered across your code base. This makes it harder for DevOps to track which variables are needed in case they need to have a quick look at the code while configuring the deployment environment.

[Read More]

Filter, Map, Reduce and Lambdas

Filter, map, and reduce are functions that are often used in functional programming. Sometimes instead of looping, you can use one of these functions to write a simple one liner. Additionally, when using this functions, we also naturally use lambdas. So first, we’ll take a look at what are lambdas.

[Read More]

What is self in Python

self is usually one of the hardest things for beginners to grasp. It is one of those concepts that you probably need to google about several times before you start to get any idea + you have to try it out and use it to fully understand it.

[Read More]
python  oop  self 

Else Is Not for Ifs Only

We all know what else means in control flow. But in Python else can appear on loops and on try/except statements. But what does it do there?

[Read More]
python 

Enum in Python

Enum is a collection of symbolic names and its values are unique and constant. In essence enums are collection of constants.

You can use enum when you have a specific string or integer appearing in several places in the code. By placing enum instead of a string, you would avoid possible errors that could be result of typos in your code.

[Read More]
python  enum 

Up and Running With Python Logging Facility

Python comes bundled with logging module. This module is very versatile, and feature rich. However, as a beginner, you mostly want to just get up and runnig, and use the logger in the most simple way. Luckally, logging in Python does not have to be hard and painful.

[Read More]