#NEWLINE# @ lower_builtin ( 'list.index' , types . List , types . Any , types . Integer , types . Integer ) #NEWLINE# def list_index( context , builder , sig , args ) : #NEWLINE# #INDENT# def list_index_impl( lst , value , start , stop ) : #NEWLINE# #INDENT# n = len ( lst ) #NEWLINE# if ( start < 0 ) : #NEWLINE# #INDENT# start += n #NEWLINE# if ( start < 0 ) : #NEWLINE# #INDENT# start = 0 #NEWLINE# #UNINDENT# #UNINDENT# if ( stop < 0 ) : #NEWLINE# #INDENT# stop += n #NEWLINE# #UNINDENT# if ( stop > n ) : #NEWLINE# #INDENT# stop = n #NEWLINE# #UNINDENT# for i in range ( start , stop ) : #NEWLINE# #INDENT# if ( lst [ i ] == value ) : #NEWLINE# #INDENT# return i #NEWLINE# #UNINDENT# #UNINDENT# raise ValueError ( 'value not in list' ) #NEWLINE# #UNINDENT# return context . compile_internal ( sig , list_index_impl , sig , args )