array slices in python
Fernando Perez
fperez528 at yahoo.com
Mon May 12 20:31:26 EDT 2003
beliavsky at aol.com wrote:
> In Python, "a[1:3]" refers to elements a[1] and a[2].
> In Fortran 95, "a(1:3)" refers to elements a(1), a(2), and a(3), which
> seems more natural. Matlab works the same way.
>
> What is the rationale for the Python convention for array slices?
Google for the following thread (recent):
Slice confusion : a[n:p] is a list exclude the last element p
Andrew Koenig's response is a detailed answer to your very question.
Cheers,
f.
More information about the Python-list
mailing list