title: python create slice object from string
body: <p>I'd like to create a slice object from a string; right now the only way seems through a cumbersome hacky eval statement</p>
  
  <pre><code>class getslice:
      def __getitem__(self, idx): return idx[0]
  eval("getslice()[%s, 1]" %(":-1"))
  </code></pre>
  
  <p>thanks in advance.</p>
  
  <p><strong>Edit</strong>: Sorry if the original prompt was not clear, the input in this case was ":-1". The point was to parse the string. Ignacio Vazquez-Abrams's response at least solved the problem (and seems to work with reverse indexing as well), but I think my solution above is still more clear if not conceptually clean (and will work correctly if Python ever changes slicing syntax).</p>