Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Use a debugger. Seriously. Decorating every function you want to keep track is a bad idea.</p> <p>Python <a href="http://docs.python.org/library/pdb.html" rel="noreferrer">has a debugger included</a>, so you don't need a good IDE.</p> <p>If you don't want to use a debugger, you can use the <a href="http://docs.python.org/library/sys.html#sys.settrace" rel="noreferrer">trace function</a>.</p> <pre><code>import sys @sys.settrace def trace_debug(frame, event, arg): if event == 'call': print ("calling %r on line %d, vars: %r" % (frame.f_code.co_name, frame.f_lineno, frame.f_locals)) return trace_debug elif event == "return": print "returning", arg def fun1(a, b): return a + b print fun1(1, 2) </code></pre> <p>That prints:</p> <pre><code>calling 'fun1' on line 14, vars: {'a': 1, 'b': 2} returning 3 3 </code></pre> <p>Even easier would be to use <a href="http://winpdb.org/" rel="noreferrer">Winpdb</a>:</p> <p>It is a <strong>platform independent</strong> graphical GPL Python debugger with support for remote debugging over a network, multiple threads, namespace modification, embedded debugging, encrypted communication and is up to 20 times faster than pdb.</p> <p>Features:</p> <ul> <li>GPL license. Winpdb is Free Software.</li> <li>Compatible with CPython 2.3 or later.</li> <li>Compatible with wxPython 2.6 or later.</li> <li>Platform independent, and tested on Ubuntu Gutsy and Windows XP.</li> <li>User Interfaces: rpdb2 is console based, while winpdb requires wxPython 2.6 or later.</li> </ul> <p><a href="http://winpdb.org/images/screenshot_winpdb_small.jpg" rel="noreferrer">Screenshot http://winpdb.org/images/screenshot_winpdb_small.jpg</a></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload