Vijaykrishna Ram

Python breakpoint() Function

Debugging in Python has had its fair share of issues for developers. A common debugger was the pdb debugger. But, to analyze the session, we would need to do something like: Output While you can get the contents of your environment and all the associated variables using pdb.set_trace(), it often becomes very time consuming to

Python breakpoint() Function Read More »

Metaclass in Python

A Metaclass is the class of a class. Whenever an instance of a class (object) is created, the way that the object behaves is defined by the Class. A Metaclass defines the behavior of the Class itself. Use of Metaclass in Python The reason behind the use of Metaclasses is that Python Classes are Objects

Metaclass in Python Read More »

Counter in Python

A Counter is a subclass of dict and is part of the Collections module. It is used for counting hashable objects. It is an unordered collection where the elements are stored as Dictionary Keys and their counts are the values. Counter Object format: {element1: count1, element2: count2} Elements are counted from an iterable or initialized from another

Counter in Python Read More »

Python Logging Module

Python Logging module is used to implement a flexible event-driven logging system, which serves as a convenient way of storing log events or messages for an application. Python Logging Module – Loggers The Logger object is the object of this module which we can manipulate to do all our required logging. To instantiate a Logger

Python Logging Module Read More »

Regular Expression in Python

The regular expression in Python are used to match a pattern with a string. Formally, a regular expression is a sequence of characters that define a search pattern. Python regular expressions are a powerful way to match text patterns. The module re, short for the regular expression, is the Python module that provides us all

Regular Expression in Python Read More »

The pickle Module in Python

We often come across a situation where we would need to store or transfer objects. The pickle module in Python is one such library that serves the purpose of storing Python objects as a serialized byte sequence into files for retrieval at a later time. Let us look into what it exactly does in this

The pickle Module in Python Read More »

@staticmethod in Python

The @staticmethod decorator Python @staticmethod decorator is used to label a class method as a static method, which means that it can be called without instantiating the class first. It simply defines a normal function that is logically contained in the class for readability purposes. Here, we do not need to pass the class instance

@staticmethod in Python Read More »

*args and **kwargs in Python

Python provides some handy ways through which we could make a function take a variable number of arguments. *args and **kwargs do just that. *args -> Represents a List / Tuple of positional arguments to be passed to any function **kwargs -> Represents a Dictionary of keyword arguments to be passed to any function Purpose

*args and **kwargs in Python Read More »