Python dynamic decorators - why so many wraps?

后端 未结 2 870
终归单人心
终归单人心 2021-02-13 03:13

So I\'m still kind of new to Python decorators - I\'ve used them before, but I\'ve never made my own. I\'m reading this tutorial (that particular paragraph) and I don\'t seem to

2条回答
  •  鱼传尺愫
    2021-02-13 03:54

    A decorator modifies a function by adding a wrapper to it. At the time you decorate the function, it isn't being called yet, so you don't have any arguments (or keyword arguments) to look at. All you can do for now is create a new function that will handle those arguments when it finally gets them.

提交回复
热议问题