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

后端 未结 3 848
猫巷女王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 11:57

    In pdb, when the function returns a ->'value' is added at the end of the line with the representation of the returned value.

    For example:

    (Pdb) s
    --Return--
    > test.py(12)do_stuff()->'f'
    -> return result
    (Pdb) q
    

    means do_stuff() returned 'f'

提交回复
热议问题