Reoedering indexes in list of list
Andreas Waldenburger
usenot at geekmail.INVALID
Wed Sep 29 09:57:10 EDT 2010
On Tue, 28 Sep 2010 11:55:18 -0700 (PDT) Toto <emayssat at gmail.com>
wrote:
> Hello,
>
> I have a list of list
> assume myList[x][y] is integer
> I would like to create an alias to that list which I could call this
> way:
> alias[y][x] returns myList[x][y]
>
> how can I do that ? (python 2.6)
>
> (I have a feeling I should use 'property' ;)
>
The zip thing certainly seems nice. But I can never get my head around
zip quick enough to not be confused by it. So my initial idea would
have been a function:
def reverse_indices(lst, x, y):
return lst[y][x]
(or, possibly, a subclass of list with this as an additional method.)
Granted, the invocation is different from what you want, but I don't
know enough about your problem to judge whether this is an issue.
/W
--
INVALID? DE!
More information about the Python-list
mailing list