title: Accessing non-consecutive elements of a list or string in python
body: <p>As far as I can tell, this is not officially not possible, but is there a "trick" to access arbitrary non-sequential elements of a list by slicing?</p>
  
  <p>For example: </p>
  
  <pre><code>&gt;&gt;&gt; L = range(0,101,10)
  &gt;&gt;&gt; L
  [0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100]
  </code></pre>
  
  <p>Now I want to be able to do</p>
  
  <pre><code>a,b = L[2,5]
  </code></pre>
  
  <p>so that <code>a == 20</code> and <code>b == 50</code></p>
  
  <p>One way besides two statements would be something silly like:</p>
  
  <pre><code>a,b = L[2:6:3][:2]
  </code></pre>
  
  <p>But that doesn't scale at all to irregular intervals.</p>
  
  <p>Maybe with list comprehension using the indices I want? </p>
  
  <pre><code>[L[x] for x in [2,5]]
  </code></pre>
  
  <p>I would love to know what is recommended for this common problem.</p>