Hi,

Im here to share a little and simple tip that I use everyday for debug my
apps.

I do not use IDE's, sometimes Komodo Edit, but most of the time I am using
VIM and Emacs.

My debugger is the shell, I am always printing results to see in shell, and
I think it is productive and useful.

to help that I figure out the simple function.

At model defined:

<code>
#debugger
def dbg(*attributes):
    print '-----------------------------------\n'
    print attributes
    while not raw_input('\nPRESS TO CONTINUE\n'):
        break
</code>

So when I want to debug some part of my code I do per example:

<code>
for row in rows:
    dbg(row)

for i,c in enumerate(rows.colnames):
   dbg(i, db[c].label, db[c].represent)

</code>
It is a simple print statement, but the advantage is that it expects a
keyBoard entry to continue the flow, at this pause I can analyse the
values.'

Someone else has any debug tip or advice for sharing?


-- 

Bruno Rocha
http://about.me/rochacbruno/bio

Reply via email to