title: Python copy : How to inherit the default copying behaviour?
body: <p>Ok ... It might be a stupid question ... but I'm not finding the answer right now !</p>
  
  <p>I need to realize the copy of an object, for which I want all the attributes to be copied, except one or two for which I want to fully control the copy.</p>
  
  <p>Here is the standard copying behaviour for an object :</p>
  
  <pre><code>&gt;&gt;&gt; class test(object):
  ...     def __init__(self, arg):
  ...         self._a = arg
  ... 
  &gt;&gt;&gt; t = test(123999)
  &gt;&gt;&gt; t._a
  123999
  &gt;&gt;&gt; tc = copy.copy(t)
  &gt;&gt;&gt; tc._a
  123999
  </code></pre>
  
  <p>Which basically means that all the attributes are copied. What I would like to do is re-use this behaviour in the following way :</p>
  
  <pre><code>&gt;&gt;&gt; class test(object):
  ...     def __init__(self, arga, argb):
  ...         self._a = arga
  ...         self._b = argb
  ...
  ...     def __copy__(self):
  ...         obj_copy = copy.copy(self) #NOT POSSIBLE OF COURSE =&gt; infinite recursion
  ...         obj_copy._b = my_operation(obj_copy._b)
  ...         return obj_copy
  </code></pre>
  
  <p>I hope you got the point : I want to re-use the object copying behaviour, but hook-in my own operations. Is there a clean way to do this (without having to do <code>for attr_name in dir(self): ...</code>) ???</p>