Exercise

Preserving docstrings when decorating functions

Your friend has come to you with a problem. They've written some nifty decorators and added them to the functions in the open-source library they've been working on. However, they were running some tests and discovered that all of the docstrings have mysteriously disappeared from their decorated functions. Show your friend how to preserve docstrings and other metadata when writing decorators.

Instructions 1/4

undefined XP
    1
    2
    3
    4
  • Decorate print_sum() with the add_hello() decorator to replicate the issue that your friend saw - that the docstring disappears.