2024 Apr 16

Cooking parallely in Python

Parallelism refers to multiple cores or processors to achieve genuine speedup which is very helpful for CPU-based tasks. There are multiple ways one can achieve parallelism in Python: Multiprocessing Parallel processing libraries (e.g., Joblib, Dask, Ray…


2024 Apr 12

Cooking concurrently in Python

Concurrency refers to the ability of a program to manage multiple tasks seemingly at the same time. While a single CPU core can only execute one instruction at a time, concurrency allows programs to juggle multiple tasks by rapidly switching between them.…


2024 Apr 05

Python generators

Generators are a powerful concept in Python that offer memory-efficient ways to create iterators. Unlike traditional iterables like lists or tuples that store all values in memory at once, generators produce values on demand, making them ideal for handlin…


2024 Apr 03

Python context managers

The with statement in Python is primarily used for resource management. It ensures that a resource is properly initialized and released when it's no longer needed, even if exceptions occur during the execution. It can also be used for suppressing certain …


2023 Feb 02

Django ORM's Hidden Magic: Advanced Uses and Techniques, Part-1

I'm assuming you already know what Django is and what is ORM. If not:- Django is a high-level web framework for building web applications quickly and with less code. It is written in Python and follows the Model-View-Template (MVT) architectural pattern. …


2023 Feb 02

Django ORM's Hidden Magic: Advanced Uses and Techniques, Part-2

Welcome back for the 2nd part, check out the first one too, as we'll be using the same models we defined there. If you're familiar with Question and Choice models in Django's official documentation that'll work too. Let's continue Relationships Relationsh…