what has python added to programming languages? (lets be esoteric, shall we ; )

beliavsky at aol.com beliavsky at aol.com
Mon Apr 24 09:33:36 EDT 2006


Michael Tobis wrote:
> Although somewhat more elegant, Python slices follow Matlab's slice
> notation. In simpler cases they are identical.
>
> mt

I think in Matlab, as in Fortran 90, i:j refers to the elements from i
up to and including j, unlike Python, where j is excluded. Another
language with slicing is S, implemented in S-Plus and R. It follows the
same convention as Fortran.

The languages treat negative subscripts of lists and arrays
differently. In Fortran, since lower bounds of arrays can be negative,
a negative subscript has no special meaning. In S, where arrays start
with element 1, a negative subscript means that the absolute value of
the subscript is excluded, so that if array x has three elements, x[-2]
refers to (x[1],x[3]). In Python, negative indices "wraparound".




More information about the Python-list mailing list