On Tue, 28 Sep 2010 11:55:18 -0700 (PDT) Toto
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
Toto writes:
>> If your "alias" can be read-only:
>> alias = zip(*myList)
>
>
>
> a=[['00','01'],['10','11']]
> l=zip(*a)
> print(l)
>
> returns... [('00', '10'), ('01', '11')]
>
> IS NOT AT ALL WHAT I WANT ;-)
>
> What I want is
>
> print a[1][0]
> '10'
> but print l[1][0]
> '01'
>
> notice the
heu the zip trick actually works... my mistake!
--
http://mail.python.org/mailman/listinfo/python-list
again I want:
alias[y][x] returns myList[x][y]
> print a[1][0]
> '10'
> but print l[1][0]
> '01'
>
> notice the indexes of the list l are inverted...
--
http://mail.python.org/mailman/listinfo/python-list
> If your "alias" can be read-only:
> alias = zip(*myList)
a=[['00','01'],['10','11']]
l=zip(*a)
print(l)
returns... [('00', '10'), ('01', '11')]
IS NOT AT ALL WHAT I WANT ;-)
What I want is
print a[1][0]
'10'
but print l[1][0]
'01'
notice the indexes of the list l are inverted...
--
h
On Tue, Sep 28, 2010 at 11:55 AM, Toto 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]
If your "alias" can be read-only:
alias = zip(*myList)
Cheers,
Chris
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' ;)
Thanks,
--
--
http://mail.python.org/mailman/list