Skip to content

The purpose of the script is to provide a simple example of how decorators work and to make their understanding easier.

Notifications You must be signed in to change notification settings

elisrizea/decorators_demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 

Repository files navigation

Decorator example (esy to understand)

From my knowledge the decorators are wrapper used to modify behavior of a function mainly
by addibg code before and/or after the decorated function or modify the arguments passed
to it. They contain a inner funtion that wrap around the decorated function and can be executed
before or after the decorated function is called

Description:

The purpose of the script is to provide a simple example of how decorators work and to make their understanding easier.
This a simple example with comments that follow all exeution steps in the first part. 
The second part is exactly the same script but using "@" to define hello_decorator(func) as a decorator to 
function_to_be_used() 

Running:

decorator_demo.py

Credits:

Alin Rizea
https://www.linkedin.com/in/alin-rizea-b10368104/

About

The purpose of the script is to provide a simple example of how decorators work and to make their understanding easier.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages