title: mutable objects in python, copies and references: howto detect trouble?
body: <p>please tell me if what I am writing is correct, and if you can answer my question at the end I am very happy:</p>
  
  <p>Is it correct that variables assigned to lists in python are "references" ? And the same is valid for other mutable objects (like dict but not tuples) ?</p>
  
  <pre><code> a = [1,2,3]
   b = a
   def app(l,e):
       l += [ e ]
  
   app(a,5)
   print b
  </code></pre>
  
  <p>gives</p>
  
  <pre><code> [1,2,3,5]
  </code></pre>
  
  <p>for having an assignment by value and not by reference I have to use <code>deepcopy</code> (from copy) ?</p>
  
  <p>The problem for me is that it is very easy to introduce bugs not paying attention to this ! So i state following</p>
  
  <p><strong>QUESTION</strong>: is there any static analysis tool (like pylint or something similar) that can issue a warning for lines like <code>b = a</code> or <code>app(a,5)</code> telling me that I am potentially altering my mutable objects (lists, dictionaries) ?</p>
  
  <p>Thank you</p>