Design Pattern: Decorator Pattern in Python

Decorator pattern is used to add some additional responsibilities to an object dynamically. We can add some new tasks, checking, etc. before and/or after the original functionality of the the object. Using the Decorator pattern we can extend the behavior, with property transparency, and without affecting other objects. In this article, we discuss the implementation of the Decorator Pattern in Python.

Python: Decorator

A decorator is a function that accepts a function and returns a function. We can perform the additional steps of operation(that we want to add before/after the original function), in the implementation of the decorator.

Design Pattern: Prototype Pattern in Python

Prototype pattern enables us to create an object from an existing object(by copying or cloning it), rather than creating an object from scratch. This process saves the overhead of the initialization process required for creating a new object from scratch. In this article, we discuss the implementation of the Prototype Pattern in Python.