---
title: "Discussion on \"Understand how decorators work in python with some examples.\" | Hashnode"
description: "Discussion on \"Understand how decorators work in python with some examples.\". Decorators in python are a way to wrap a function around some code. You can think of it as a middleware for a function in which we can run some code before and after executing the main function. So, A decorator is a function that takes another functi..."
url: "https://hashnode.com/posts/understand-how-decorators-work-in-python-with-some-examples/63fa38b82bfedd8aa4fc6491"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Understand how decorators work in python with some examples.](https://jaspreetsh.hashnode.dev/understand-how-decorators-work-in-python-with-some-examples?utm_source=hashnode&utm_medium=feed)

Decorators in python are a way to wrap a function around some code. You can think of it as a middleware for a function in which we can run some code before and after executing the main function. So, A decorator is a function that takes another functi...

Feb 25, 2023 · 4 min read · jaspreetsh.hashnode.dev  
Read the article

-   [#python](https://hashnode.com/tag/python)
-   [#python3](https://hashnode.com/tag/python3)
-   [#python-beginner](https://hashnode.com/tag/python-beginner)
-   [#web-development](https://hashnode.com/tag/web-development)
-   [#learning](https://hashnode.com/tag/learning)

## Written by

[Jaspreet Singh](https://hashnode.com/@singhjaspreet)

@singhjaspreet · India

  
[View profile](https://hashnode.com/@singhjaspreet)

Backend developer

Software developer who loves solving problems and building things and has an interest in contributing to open-source.

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
