Python Tips and Tricks: Decorator Factories and Optional Arguments

Опубликовано: 26 Июнь 2026
на канале: MathByte Academy
2,027
95

This video explores one simple technique to create a decorator factory that allows using the decorator both with and without arguments - similar to some of the decorators you will come across in the Python standard library that can be used with parameters and without (like `lru_cache`).


1:15 - Simple decorators refresher
10:48 - Decorator factories and arguments

#mathbyteacademy #python

Code for this Video
================
Available in GitHub blog repo: https://github.com/fbaptiste/python-blog
Direct link: https://tinyurl.com/mpkm9tee

My Python Courses
=================

Python 3 Fundamentals (introduction to Python)
https://www.udemy.com/course/python3-...

Python 3 Deep Dive (Part 1 - Functional)
https://www.udemy.com/course/python-3...

Python 3 Deep Dive (Part 2 - Iteration, Generators)
https://www.udemy.com/course/python-3...

Python 3 Deep Dive (Part 3 - Hash Maps)
https://www.udemy.com/course/python-3...

Python 3 Deep Dive (Part 4 - OOP)
https://www.udemy.com/course/python-3...