[Tutor] Program gets stuck after a creating a list from dictinary items!

Prasad, Ramit ramit.prasad at jpmorgan.com
Sat Jul 7 00:17:32 CEST 2012


> > Also what are you using the pdb traces for?
> > Do they show any output?
> Actually printing some thing after that line does not show any thing, I have the pdb.set_trace()'s for debugging, to see what's going on inside. ho would you debug that?

When debugging, I usually just add more print or logging statements.

             print('Calculating D for prog {0}'.format(prog))
             D=[prog[key1] for key1 in sCommonFeatures]
             print('D calculated to be {0}'.format(D))

This lets me see the inputs and output of a block of code.
And for longer algorithms I would put more print statements
to track what is occurring. For example, if you are in a loop, 
it can be useful to use enumerate() so you have a loop counter
and can see which iteration the problem is occurring on. 


But I have not used pdb very much.

Ramit


Ramit Prasad | JPMorgan Chase Investment Bank | Currencies Technology
712 Main Street | Houston, TX 77002
work phone: 713 - 216 - 5423

--
This email is confidential and subject to important disclaimers and
conditions including on offers for the purchase or sale of
securities, accuracy and completeness of information, viruses,
confidentiality, legal privilege, and legal entity disclaimers,
available at http://www.jpmorgan.com/pages/disclosures/email.  


More information about the Tutor mailing list