Paul Rubin wrote:
> Gabriel Genellina <[EMAIL PROTECTED]> writes:
> 
>>>  >>> sorted((x[1], x[0]) for x in enumerate(a))
>>>[(1, 7), (2, 4), (2, 8), (3, 2), (4, 1), (5, 3), (6, 5), (7, 6), (9, 0)]
>>
>>Why forcing to use enumerate if it doesn't fit? And a generator won't
>>help here since you have to access all the items.
>>
>>sorted([(a[i],i) for i in range(len(a))])
> 
> 
> I think 
> 
>    sorted((x,i) for i,x in enumerate(a))
> 
> looks nicer than the above. 

Indeed it does: an excellent refinement of my rather crappily-expressed 
original idea.

regards
  Steve
-- 
Steve Holden       +44 150 684 7255  +1 800 494 3119
Holden Web LLC/Ltd          http://www.holdenweb.com
Skype: holdenweb       http://holdenweb.blogspot.com
Recent Ramblings     http://del.icio.us/steve.holden

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to