[Tutor] about array

Luke Paireepinart rabidpoobear at gmail.com
Tue Dec 26 08:20:01 CET 2006


Oops, another one where I replied off-list.

---------- Forwarded message ----------
From: Luke Paireepinart <rabidpoobear at gmail.com>
Date: Dec 26, 2006 12:46 AM
Subject: Re: [Tutor] about array
To: "linda. s" <samrobertsmith at gmail.com>



On 12/26/06, linda.s <samrobertsmith at gmail.com> wrote:
>
> When I read the following code, I found it was very hard for me to
> understand the meaning of a[1:3,:-1:2]  for a[i,j] for i=1,2 and
> j=0,2,4; the same as a[::3,2:-1:2]


What is your question here?
you want an explanation of list slicing?
what does this mean?
"
the meaning of a[1:3,:-1:2]  for a[i,j] for i=1,2 and
j=0,2,4; the same as a[::3,2:-1:2]
"

Do you mean your lack of understanding is the same in both cases or the
slices are the same?
they aren't.
The weird way you worded this was really confusing, and I'm not sure what
you meant.

>>> a
> array([[ 0., 1., 2., 3., 4., 5.],
> [ 6., 7., 8., 9., 10., 11.],
> [ 12., 13., 14., 15., 16., 17.],
> [ 18., 19., 20., 21., 22., 23.],
> [ 24., 25., 26., 27., 28., 29.]])

Where'd this array function come from?
Are you using Numeric or Numpy or something?
in that case, these should have good documentation on how list slicing works
in them.
It should be the same as in regular Python, but I won't assume that's the
case,
because I have no experience with any of these libraries.

or are you using the built-in Python array function?

It probably doesn't matter, but the more information, the better.

Again, I don't have access to a python interpreter, so I can't give you any
specific help.
But you should read an article on Python list slicing.
I'd have to say GIYF here.
If you find an article and when you're reading through it you come to
something that doesn't make sense, and ask about that specifically, it will
be easier for us to answer.


HTH,
-Luke
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20061226/586bb8e7/attachment.html 


More information about the Tutor mailing list