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. 
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to