Thus spoke [EMAIL PROTECTED] (on 2006-06-23 00:57): > Maybe you want something like this (but this doesn't use map): > [(r,c) for r, row in enumerate(m) for c in xrange(len(row))]
Ahh, its a 'list comprehension', nice. Now, lets see how the decorate/undecorate sort turns out to look in Python: arr = [ [3,3,3,3], [3,3,3,1], [3,3,3,3] ] print \ sorted( [ (j,i) for j, row in enumerate(arr) for i in xrange(len(row)) ], lambda a,b: (arr[a[0]][a[1]] - arr[b[0]][b[1]]) )[ 0 ] ==> prints indices: (1,3) He, this looks more like Haskell than like Python (for me, it looks awful ;-) I'll try to come up with at least one map inside the comprehension, if that works - just to avoid the dual for ;-) Reagrds and thanks Mirco -- http://mail.python.org/mailman/listinfo/python-list