r/pythontips • u/deepak_vi • Jan 02 '22
Python3_Specific Validations in Python using Metaprogramming Decorators- Advanced Python
Validations in Python using Metaprogramming Decorators- Advanced Python
A #Decorator is a special kind of declaration that can apply to a function to enhance its functionality*.* This is also called known as #metaprogramming. Here we are trying to modify the functionality of a function on compile time. Metaprogramming is a cool concept in ant programing language. It can be used to apply certain checks before executing the actual function.Β
Letβs try to understand the use-case with an example.
Learn More: Validations in Python using Metaprogramming Decorators
35
Upvotes
4
u/Discchord Jan 02 '22
This is one of the best examples of Decorators I've read. It's fairly easy to follow. The length is just right, to fully describe the concept; without overkill.