A list of helpful self-made Python decorators. Might be of use to someone while thinking about some design patterns you could use in your next project.
All code and examples are made to run on Python 3.3+
@use_this_decorator
def on_this_function():
pass
A group of helpful decorators for debugging and optimizing your code. Decorate your functions to keep track of how many times you call them and how long their execution takes.
A short take on Behaviour Driven Development testing.
Decorators that change the function or it's input arguments. Or both.
A fun way to emulate the command line in under 50 lines of code. Try it!
The decorator that executes the given function only if the condition is met.
Deterministic Finite Automaton Emulator. A really simplified one, at least.
Executes the given function in the main thread.
I should really get a better name for this. Best to check the example.
Prints the function, it's arguments and result. Really helpful for debugging.
Emulates a giant stack on which to put results that can be taken care of later.
A slightly different take on ternary operator.
Writing a lot of functions that are only defined? Use this.
C-style va_args operator.