wrappers

Reusables – Part 2: Wrappers

Spice up your code with wrappers! In Python, a wrapper, also known as a decorator, is simply encapsulating a function within other functions. @wrapper def my_func(a, b=2): print(b) @meta_decorator(foo=”bar”) def my_other_func(**kwargs): print(kwargs) In Reusables, all the wrappers take arguments, aka meta decorators, so you will at...

Continue reading...

Python Decorators

Often times in python there comes a need to have multiple functions act in a similar manner. It could be anything from making sure that similar functions output the right type of result, they all log when they are called or all report exceptions in the...

Continue reading...
The owner of this website has made a commitment to accessibility and inclusion, please report any problems that you encounter using the contact form on this website. This site uses the WP ADA Compliance Check plugin to enhance accessibility.