0
Decorators & exceptions in Python
Write a decorator named "logo" which takes a sequence of tags and logs a message in case an exception happens within the decorated function. #something like this, ain't sure how to got about it def log(utf8_string, tags): def logo(log): #Example usage @logo('tag_one', 'tag_two') def example(): raise Exception("There's been an error")
1 ответ
0
Decorators are covered in the Intermediate Python course, lesson 15.
A more detailed writeup is here:
https://realpython.com/primer-on-python-decorators/