Skip to main content

Python

Why Use WSGI/ASGI When We Have Nginx?

·4 mins
Introduction # When it comes to deploying Python web applications, a common architecture involves using a web server like Nginx to handle incoming requests, while the Python application itself runs on a separate server. In this architecture, the web server serves as a reverse proxy, forwarding requests to the Python application server and then returning the response back to the client.

__str__ vs __repr__ in Python and When to Use Them

·3 mins
Introduction # In a previous post, we have done a comparison between __new__ and __init__. In this post, we are going to do something similar, but with a different pair. For those who don’t know, __str__() and __repr__() are two dunder methods which you can override in a class to change the way class is represented. These two little functions have been a source of confusion in my early career. Let us first go through them one by one and let us understand what they do first. Then we’ll do comparison among them with respect to their similarities and differences.

How to Write Classes in Golang

·3 mins
Introduction # I have seen many people coming from Python background struggling with Go. What I have obeserved it they write code that is limited to writing functions and calling them. They never leverage design constructs such as abstraction, encapsulation, inheritance, composition etc. I can understand their pain because I’ve been in the same boat. In today’s post I’ll compare how we write classes in Python vs how we do the same thing in a Go way.

__init__ vs __new__ and When to Use Them

·5 mins
Introduction # I recently got asked to me what did __init__ dunder method did in Python. And I was like, “it is used to initialize variables inside a class”. And just after that, the follow-up question was, “then what is __new__ used for. And I was completely blank and was not able to answer that. I was not able to answer that question because there are not many tutorials out there that talk about __new__. I didn’t want to happen this with you. And that is why I came up with this blog post for you.

I Tried Open edX and it's Awesome

·7 mins
Introduction # Ed-tech industry in India was valued at US$750 million in 2020, and is projected to be $1.04 billion by 2021. (source) I am documenting the process of edx installation on local system for evaluating. I’m not doing a comparision with any similar product here. Also, I’m writing this post from a develper’s perspective of course, because I’m a software developer. Don’t expect any business related expertise from here.

This is how OOPs and Mocking are related to Dependency Injection

Introduction # There are a few words, like unit testing, integration testing, mocking, dependency injection, object oriented proramming. These are all friends, and areall related to each other. In this post I’m going to talk how, and then it will start to make sense to you. This post is divided into these subsections: Preamble The Testing part The OOPs part The dependency injection part A real life problem I’ll start with how I started with unit testing.