index
find index of element within list
Calling Sequence
Parameters
Description
Examples
x.index(y)
x
-
List object
y
Expression or Python expression
The index function returns the index of y within the List x. If y does not appear in x, a ValueError is raised.
Note that as x is a Maple list, the index of the first element is 1.
The following interactive session illustrates the use of index:
>>> import maple
>>> import maple.namespace
>>> S1 = maple.execute('[ a, b, c, 2, 3, 4 ]:')
>>> S1.index( maple.namespace.b )
2
>>> S1.index( 3 )
5
>>> S1.index( maple.namespace.x )
ValueError: is not in list
See Also
member
OpenMaple
OpenMaple/Python/API
OpenMaple/Python/Expression
OpenMaple/Python/List
Download Help Document