How would you write a @debuggable decorator in python?

前端 未结 5 749
孤街浪徒
孤街浪徒 2020-12-24 03:57

When debugging, I like to print out all the inputs and outputs of a function (I know I need a better IDE, but humour me, this could be used for error reporting). So, I\'d id

5条回答
  •  有刺的猬
    2020-12-24 04:35

    I second what nosklo said.

    Another thing to notice is that your function is a bit dangerous:

    b = myfunc(1,3)
    

    In this case, "b" is None, because the decorated function doesn't return anything.

提交回复
热议问题