On Tuesday 10 May 2011 11:25:59 Terry Reedy wrote:
On 5/9/2011 8:44 PM, Algis Kabaila wrote:
The method of double indexing in the manner
a[i][j]
for the (i, j) -th element of multi-dimensional array is
well known and widely used. But how to enable the
standard matrix notation a[i, j]
On Tuesday 10 May 2011 17:22:42 Algis Kabaila wrote:
On Tuesday 10 May 2011 11:25:59 Terry Reedy wrote:
On 5/9/2011 8:44 PM, Algis Kabaila wrote:
The method of double indexing in the manner
a[i][j]
for the (i, j) -th element of multi-dimensional array is
well known and widely used.
On 5/10/2011 3:22 AM, Algis Kabaila wrote:
On Tuesday 10 May 2011 11:25:59 Terry Reedy wrote:
class listwrap:
def __init__(self, lis):
self._list = lis
def __getitem__(self, dex):
i,j = dex
return self._list[i][j]
# __setitem__: exercise for reader
l =
On Tuesday 10 May 2011 17:44:44 Terry Reedy wrote:
On 5/10/2011 3:22 AM, Algis Kabaila wrote:
On Tuesday 10 May 2011 11:25:59 Terry Reedy wrote:
class listwrap:
def __init__(self, lis):
self._list = lis
def __getitem__(self, dex):
i,j = dex
return
Just learning python.
I can see that I can address an individual element of a list of lists
by
doing something like:
row = list[5]
element = row[3]
But is there a way to directly address an entry in a single statement?
Thanks for any help.
Regards
Chris Roy-Smith
suppose you have a list like
On 5/9/2011 4:25 AM, Antonio CHESSA wrote:
apple = [[a,b,c],[1,2,3,4,5,6],[antony,max,sandra,sebastian]]
apple[0] = [a,b,c]
apple[1] = [1,2,3,4,5,6]
apple[2] = [antony,max,sandra,sebastian]
apple[0][1] = b
apple[2][3] = sebastian
to view all videos in a loop so you can set:
for i in
On Tuesday 10 May 2011 05:24:16 Terry Reedy wrote:
On 5/9/2011 4:25 AM, Antonio CHESSA wrote:
apple =
[[a,b,c],[1,2,3,4,5,6],[antony,max,sandra,seb
astian]]
for j in range (len(apple[i])):
print apple[i][j]
While this illustrate double indexing, it can be simplified
to
On 5/9/2011 8:44 PM, Algis Kabaila wrote:
The method of double indexing in the manner
a[i][j]
for the (i, j) -th element of multi-dimensional array is well known and
widely used. But how to enable the standard matrix notation
a[i, j]
in Python 3.2 in the manner of numpy (and other matrix
Just learning python.
I can see that I can address an individual element of a list of lists by
doing something like:
row = list[5]
element = row[3]
But is there a way to directly address an entry in a single statement?
Thanks for any help.
Regards
Chris Roy-Smith
--
On Mon, May 9, 2011 at 1:15 PM, Chris Roy-Smith
chris_roysmith.noth...@internode.on.net wrote:
Just learning python.
I can see that I can address an individual element of a list of lists by
doing something like:
row = list[5]
element = row[3]
But is there a way to directly address an entry
On Mon, May 9, 2011 at 1:23 PM, Chris Angelico ros...@gmail.com wrote:
Just learning python.
I can see that I can address an individual element of a list of lists by
doing something like:
row = list[5]
element = row[3]
This is the correct approach.
Here's an interactive example (tested):
$
11 matches
Mail list logo