+ 16
It is already well explained in the module... the decor function having nested wrap function & (func) as parameter will return wrap function... 1st the print_text() func is passed as parameter to decor function... so wrap function begins 1--> prints the 1st string "=====" 2--> calls the func() which returns the print_text function & prints out "Hello World!" 3--> prints the last string "=====" 2nd time print_exit() is passed as parameter... same thing repeats this time "Exit" will be printed... instead of "Hello World!" https://www.sololearn.com/learn/JUMP_LINK__&&__Python__&&__JUMP_LINK/2463/?ref=app
5th Mar 2018, 11:14 AM
🌛DT🌜
🌛DT🌜 - avatar
+ 11
yes it will give the same output 😀 it is just an eg to show how to use decorator basically decorator is used to extend the functionality of a function ... by nesting functions. may be more than 1 nested func many times... it will be used accordingly check out this 👇 https://realpython.com/blog/JUMP_LINK__&&__python__&&__JUMP_LINK/primer-on-python-decorators/
6th Mar 2018, 4:08 AM
🌛DT🌜
🌛DT🌜 - avatar