title: Emulating pass-by-value behaviour in python
body: <p>I would like to emulate the pass-by-value behaviour in python. In other words, I would like to make absolutely sure that the function I write do not modify user supplied data. </p>
  
  <p>One possible way is to use deep copy:</p>
  
  <pre><code>from copy import deepcopy
  def f(data):
      data = deepcopy(data)
      #do stuff
  </code></pre>
  
  <p>is there more efficient or more <em>pythonic</em> way to achieve this goal, making as few assumptions as possible about the object being passed (such as .clone() method)</p>
  
  <p><strong>Edit</strong> </p>
  
  <p>I'm aware that technically everything in python is passed by value. I was interested in <em>emulating</em> the behaviour, i.e. making sure I don't mess with the data that was passed to the function. I guess the most general way is to clone the object in question either with its own clone mechanism or with deepcopy.</p>