Given a "jumbled" list L, get a list where each element is the index of the corresponding element of L, if L was sorted
<p></p>

<h2>Desired Output</h2>

<p>I want a function to return a list such that, given a "jumbled" list <code>l</code>, each element is the index of the corresponding element of <code>l</code>, if <code>l</code> was sorted. (I'm failing to think of a less convoluted way of saying this, sorry.)</p>

<p><strong>Examples</strong></p>

<p><code>f([3,1,2])</code> = <code>[2,0,1]</code> </p>

<p><code>f([3,1,2,2,3])</code> = <code>[3,0,1,2,4]</code>, since the input sorted is <code>[1,2,2,3,3]</code>.</p>

<p>(This is useful for some stats calculations.)</p>

<h2>My Attempt</h2>

<p>I came up with a way to do this function, but this is <em>python</em>- it seems like there should be a one-liner to do this, or at least a much cleaner, clearer way.</p>

<pre><code>def getIndiciesInSorted(l):
    sortedL = sorted(l)
    outputList = []
    for num in l:
        sortedIndex = sortedL.index(num)
        outputList.append(sortedIndex)
        sortedL[sortedIndex] = None
    return outputList

l=[3,1,2,2,3] 
print getIndiciesInSorted(l)
</code></pre>

<p>So, how can I write this more concisely? Is there a legible list comprehension solution?</p>
