Sorted collections: How do i get (extended) slices right?
<p>How can I resolve this?</p>

<pre><code>&gt;&gt;&gt; class unslice:
...     def __getitem__(self, item): print type(item), ":", item
...
&gt;&gt;&gt; u = unslice()
&gt;&gt;&gt; u[1,2]    # using an extended slice
&lt;type 'tuple'&gt; : (1, 2)
&gt;&gt;&gt; t = (1, 2)
&gt;&gt;&gt; u[t]  # or passing a plain tuple
&lt;type 'tuple'&gt; : (1, 2)
</code></pre>

<p>Rational: </p>

<p>I'm currently overengineering a sorted associative collection with the ability to return ranges of items. It is quite likely that I will want to store tuples of small integers (or even more pathologically wierd values like Ellipsis) in the collection (as keys), and will need some kind of sane way of differentiating extended slices from plain keys</p>

<p>In the one-dimensional case, it's sort of a non-issue.  I can't think of any real reason I would want to collect values of type <code>slice</code>, especially since <code>xrange</code> values are functionally similar and more recognizable to pythonistas (in my judgement).  All other extended slice constructs are tuples of <code>slice</code>, <code>Ellipsis</code> or plain-old python values</p>

<p>No other type of extended slice seems to be in common use for any kind of collection except multidimensional arrays as in NumPy.</p>

<p>I do need to support n-dimensional axes, similar to oct-trees or GiS indices. </p>
