How do you see the return value from a function in the Python debugger, without an intermediate?

后端 未结 3 846
猫巷女王i
猫巷女王i 2021-02-05 11:30

PDB (and other Python debuggers) have a simple way of viewing the value of any current variable, just by typing it in. However, sometimes I work with libraries that don\'t store

3条回答
  •  孤街浪徒
    2021-02-05 12:01

    Can you explain more?

    • By debugger, do you mean you are using a logger? Are you stepping through with an IDE?
    • What do you mean by "see the return value"? If you just want to print it...

      def do_stuff(*args, **kwds):
          result = f(*args, **kwds)
          print result
          return result
      

提交回复
热议问题