Implementing in Python.

Sync


((10*5)+5 - missing brackets
{a+[c+(10*d)]} - ok
{x+[y+(z+d])} - missing brackets
5
((10*5)+5
False
{a+[c+(10*d)]}
True
{x+[y+(z+d])}
False
{{[[(())]]}}
True


Django ORM optimization cheat sheet

Photo by Caspar Camille Rubin on Unsplash
class Author(models.Model):
name = models.CharField(max_length=200)
email =…


Checking how many queries reduce using these methods with an example

Photo by Etienne Boulanger on Unsplash


Understanding lambda, map, filter, reduce with examples.

lambda

Basic syntax

lambda arguments : expression

Example

add = lambda x, y: x + y
print(add(2, 3))


Writing a singleton decorator to use with any class

Photo by Patrick Schneider on Unsplash


A brief description of decorators in Python with an easy example

Photo by Shahadat Rahman on Unsplash

Functions

  • Functions are objects — they can be referenced to, passed to a variable and returned from other functions as well.
  • Functions can be defined inside another function — an inner function — and can also be passed as an argument…


Write less, do more

Photo by Austin Neill on Unsplash

Occurrence Counter in List

from collections import Counternum_lst = [1, 1, 2, 3, 4, 5, 3, 2, 3, 4, 2, 1, 2, 3]
cnt = Counter(num_lst)
print(dict(cnt))
# first 2 most occurrence
print(dict(cnt.most_common(2)))
str_lst = ['blue', 'red', 'green', 'blue', 'red', 'red', 'green']
print(dict(Counter(str_lst)))
{1: 3, 2: 4, 3: 4, 4: 2, 5…


Deep dive into QuerySet’s evaluation and caching with examples

Photo by Christopher Gower on Unsplash
from django.db import models

class Blog(models.Model):
name = models.CharField(max_length=100)…


Understanding Django life cycle.

Request-Response life cycle in Django

Goutom Roy

Engineer, son, brother, husband, friend, archaeology enthusiast, and history maniac.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store