0
The best way to understand the decoration
Hi guys! Code: **************** def decor(func): print ("decor(func) is running one time only.") def wrap(): print("============") func() print("============") return wrap def print_text(): print("Hello world!") print_text = decor(print_text) print("decor(func) will never work again.") print_text(); print_text(); print_text(); Output: **************** decor(func) is running one time only. decor(func) will never work again. ============ Hello world! ============ ============ Hello world! ============ ============ Hello world! ============
2 odpowiedzi
+ 8
Deconstruct it and rebuild it function by function?
0
What is the question?