Skip to content

GrgoMariani/Python-Decorators

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Python Decorators

Description

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

Analyze

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.

Check Example Code

BDD tests

A short take on Behaviour Driven Development testing.

Check Example Code

Change

Decorators that change the function or it's input arguments. Or both.

Check Example Code

Command Line

A fun way to emulate the command line in under 50 lines of code. Try it!

Check Example Code

Conditional

The decorator that executes the given function only if the condition is met.

Check Example Code

DFA

Deterministic Finite Automaton Emulator. A really simplified one, at least.

Check Example Code

do in main thread

Executes the given function in the main thread.

Check Example Code

Max Refresh

I should really get a better name for this. Best to check the example.

Check Example Code

Print Me

Prints the function, it's arguments and result. Really helpful for debugging.

Check Example Code

Stack Results

Emulates a giant stack on which to put results that can be taken care of later.

Check Example Code

Ternary

A slightly different take on ternary operator.

Check Example Code

TODO

Writing a lot of functions that are only defined? Use this.

Check Example Code

VA_ARGS

C-style va_args operator.

Check Example Code

Releases

No releases published

Packages

No packages published

Languages