title: Putting a break point when a condition on a variable is satisfied
body: <p>Let's say I have the following code:</p>
  
  <pre><code>def f(lst,k):
      if k % 5 == 0:
         lst.append(str(k+1))
      return k*len(lst)
  
  def big_function():
      my_list = ["a","b","c","d"]
      s = 0
      for k in range(10):
          tmp = f(my_list,k)
          s += tmp
      return s
  </code></pre>
  
  <p>If I run it, the variable <code>my_list</code> in the function <code>big_function</code> will become <code>["a","b","c","d","6"]</code>. Let's say that the following was a mistake:</p>
  
  <pre><code>if k % 5 == 0:
      lst.append(str(k+1))
  </code></pre>
  
  <p>And that I didn't intend to modify <code>my_list</code>. </p>
  
  <p>Is there a way to run pdb in a way that would be like <code>python -m pdb my_script.py --condition "is_modified(my_list, scope = big_function)"</code> and so the program is interrupted with a debug prompt at the line <code>lst.append(str(k+1))</code> when <code>k</code> is 5.</p>
  
  <p>The point is that while this particular example is very simple and straightforward to analyze, in a bigger function it will be hard to track when a variable got modified by a sub function, and I want pdb to do that work for me but so far I've been unsuccessful.</p>