title: h5py: Correct way to slice array datasets
body: <p>I'm a bit confused here:</p>
  
  <p>As far as I have understood, h5py's <code>.value</code> method reads an entire dataset and dumps it into an array, which is slow and discouraged (and should be generally replaced by <code>[()]</code>. The correct way is to use numpy-esque slicing.</p>
  
  <p>However, I'm getting irritating results (with h5py 2.2.1):</p>
  
  <pre><code>import h5py
  import numpy as np
  &gt;&gt;&gt; file = h5py.File("test.hdf5",'w')
  # Just fill a test file with a numpy array test dataset
  &gt;&gt;&gt; file["test"] = np.arange(0,300000)
  
  # This is TERRIBLY slow?!
  &gt;&gt;&gt; file["test"][range(0,300000)]
  array([     0,      1,      2, ..., 299997, 299998, 299999])
  # This is fast
  &gt;&gt;&gt; file["test"].value[range(0,300000)]
  array([     0,      1,      2, ..., 299997, 299998, 299999])
  # This is also fast
  &gt;&gt;&gt; file["test"].value[np.arange(0,300000)]
  array([     0,      1,      2, ..., 299997, 299998, 299999])
  # This crashes
  &gt;&gt;&gt; file["test"][np.arange(0,300000)]
  </code></pre>
  
  <p>I guess that my dataset is so small that <code>.value</code> doesn't hinder performance significantly, but how can the first option be that slow?
  What is the preferred version here?</p>
  
  <p>Thanks!</p>
  
  <p><strong>UPDATE</strong>
  It seems that I wasn't clear enough, sorry. I do know that <code>.value</code> copies the whole dataset into memory while slicing only retrieves the appropiate subpart. What I'm wondering is why slicing in file is <em>slower</em> than copying the whole array and then slicing in memory.
  I always thought hdf5/h5py was implemented specifically so that slicing subparts would always be the fastest.</p>