AnsweredAssumed Answered

How to get the last element of a polyline array?

Question asked by menno.nijhuis on Jul 1, 2013
Latest reply on Jul 2, 2013 by menno.nijhuis
To my surprise, it is impossible to get the last element of an array from a polyline (which is a arcpy.arcobjects.arcobjects.Array, so not a normal Python array for which it would definitely work!).

my_array[-1]

throws this error:
Runtime error <type 'exceptions.RuntimeError'>: Array: Error in getting object from array


EDIT:

OK a rather stupid workaround I thought of myself:
my_array.getObject(len(my_array)-1)

gives:
<Point (280349.568, 311663.817, #, 162.393)>

I still wonder: why is it not possible to just use my_array[-1]

Outcomes