set pdb break condition based upon number of hits?

Diez B. Roggisch deets at nospam.web.de
Thu Nov 5 02:41:31 CET 2009


Reckoner schrieb:
> Is it possible to set pdb break condition based upon number of hits? I
> mean something like
> 
> (Pdb) break line_number (number_of_hits_for_this_breakpoint >10)
> 
> any help appreciated.

MY_GLOBAL_COUNTER = 0

MY_GLOBAL_COUNTER += 1
if MY_GLOBAL_COUNTER >= 10:
     import pdb; pdb.set_trace()

Diez



More information about the Python-list mailing list