Last active
January 1, 2025 13:03
-
-
Save Sllayan/45d8dc7d8b47a2a5c72447907e0b0c07 to your computer and use it in GitHub Desktop.
Revisions
-
Sllayan revised this gist
Jan 1, 2025 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,3 @@ # Python decorator ## This is an example of simple decorator in Python -
Sllayan revised this gist
Nov 23, 2024 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,3 @@ # Python decorator ### This is an example of simple decorator in Python -
Sllayan revised this gist
Nov 23, 2024 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,3 @@ # Python decorator ### This is an example of simple python decorator -
Sllayan revised this gist
Nov 23, 2024 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,3 @@ # Python decorator This is an example of simple python decorator -
Sllayan created this gist
Nov 23, 2024 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,3 @@ ### Python decorator This is an example of simple python decorator This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,22 @@ # Decorator function def my_decorator(func): def wrapper(): print('Anything that needs to be done before the function is called.') func() print('Anything that needs to be done after the function is called.') return wrapper # First usecase def say_hello(): print('hello') say_it = my_decorator(say_hello) say_it() # Second usecase @my_decorator def say_hello(): print('hello') say_hello()