[TxMt] Re: insert breakpoints in python code

Jacob Rus jrus at hcs.harvard.edu
Fri Apr 13 13:22:08 UTC 2007

Dougal wrote:
> This would be much simpler to do with a real snippet, rather than a 
> command.
> Choose "New Snippet" from the bottom-left of the bundle editor, and then
> just type "import pdb; pdb.set_trace()" in the big box. This can be tab- or
> shortcut-activated.

I think the point was to put it the line before the current line.

> Also, I don't really know python, but I'm guessing that you only need to
> import pdb once per file; afterwards, you can just use pdb.set_trace().

Python doesn't care if you import something multiple times.  So I'm 
guessing he does it that way to a) make sure it always gets imported, b) 
ensure it always gets cleaned up (i.e. all the import statements go 
away) when he comments or deletes those lines, and c) keep the code he 
uses to set a breakpoint consistent.


More information about the textmate mailing list