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


pdb (and other python debuggers) have simple way of viewing value of current variable, typing in. however, work libraries don't store return values in intermediate variables.

here's example function:

def do_stuff(*args, **kwds):      return f(*args, **kwds) 

after return f, how see return value? rewrite libraries after download them have intermediate:

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

but seems there should better way.

you can hidden __return__ local variable.

if forget it's exact name, explore by:

(pdb) sorted(locals().keys()) ['__return__', 'xyz', ...] 

edit: related later answer example __return__


Comments

Popular posts from this blog

jquery - Invalid Assignment Left-Hand Side -

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -