title: Passing subset reference of array/list as an argument in Python
body: <p>I'm kind of new (1 day) to Python so maybe my question is stupid. I've already looked <a href="https://stackoverflow.com/questions/986006/python-how-do-i-pass-a-variable-by-reference">here</a> but I can't find my answer.</p>
  
  <p>I need to modify the content of an array at a random offset with a random size.
  I have a Python API to interface a DDL for an USB device which I can't modify. There is a function just like this one :</p>
  
  <pre><code>def read_device(in_array):
      # The DLL accesses the USB device, reads it into in_array of type array('B')
      # in_array can be an int (the function will create an array with the int 
      # size and return it), or can be an array or, can be a tuple (array, int)
  </code></pre>
  
  <p>In MY code, I create an array of, let's say, 64 bytes and I want to read 16 bytes starting from the 32rd byte. In C, I'd give <code>&amp;my_64_array[31]</code> to the <code>read_device</code> function.
  In python, if a give :</p>
  
  <pre><code>read_device(my_64_array[31:31+16])
  </code></pre>
  
  <p>it seems that in_array is a reference to a copy of the given subset, therefore <code>my_64_array</code> is not modified.</p>
  
  <p>What can I do ? Do I have to split <code>my_64_array</code> and recombine it after ??</p>