title: Turn slice into range
body: <p>I'm using Python 3.3. I want to get a <code>slice</code> object and use it to make a new <code>range</code> object.</p>
  
  <p>It goes something like that:</p>
  
  <pre><code>&gt;&gt;&gt; class A:
      def __getitem__(self, item):
          if isinstance(item, slice):
              return list(range(item.start, item.stop, item.step))
  
  &gt;&gt;&gt; a = A()
  &gt;&gt;&gt; a[1:5:2] # works fine
  [1, 3]
  &gt;&gt;&gt; a[1:5] # won't work :(
  Traceback (most recent call last):
    File "&lt;pyshell#18&gt;", line 1, in &lt;module&gt;
      a[1:5] # won't work :(
    File "&lt;pyshell#9&gt;", line 4, in __getitem__
      return list(range(item.start, item.stop, item.step))
  TypeError: 'NoneType' object cannot be interpreted as an integer
  </code></pre>
  
  <p>Well, the problem is obvious here - <code>range</code> doesn't accept <code>None</code> as a value:</p>
  
  <pre><code>&gt;&gt;&gt; range(1, 5, None)
  Traceback (most recent call last):
    File "&lt;pyshell#19&gt;", line 1, in &lt;module&gt;
      range(1, 5, None)
  TypeError: 'NoneType' object cannot be interpreted as an integer
  </code></pre>
  
  <p>But what is not obvious (to me) is the solution. How will I call <code>range</code> so it will work in every case?
  I'm searching for a nice pythonic way to do it.</p>