[Pythonmac-SIG] Mac User Python Newbies

Bob Ippolito bob at redivi.com
Sat Feb 12 05:38:04 CET 2005


On Feb 11, 2005, at 11:12 PM, Roger Binns wrote:

>>>>  import pdb ; pdb.set_trace()
>>>
>>> Use this instead:
>>>
>>>   import pdb; pdb.Pdb().set_trace()
>>>
>>> It is more convenient in that you end up at the stack level you 
>>> actually want to be at, rather than inside [pdb]
>
> Yes, but it is 4 more characters to type extra Pdb(). versus 'n' and 
> return :-)

True, but if it's in application code, not at the interpreter, then you 
can easily make up for it in consecutive runs.

try:
     do stuff
except:
     import pdb
     pdb.post_mortem(sys.exc_info()[2])

is also useful..

Or, if you're running with python -i, there's pdb.pm() (which should 
really be a shortcut for the former in the general case)

-bob



More information about the Pythonmac-SIG mailing list