#NEWLINE# def by_index( self ) : #NEWLINE# #INDENT# 'Same generator as __iter__, but yield only the chosen indexes' #NEWLINE# counter = [ 0 , 0 , 0 ] #NEWLINE# for chosen in self . permut : #NEWLINE# #INDENT# index = counter [ chosen ] #NEWLINE# counter [ chosen ] = ( ( counter [ chosen ] + 1 ) % self . limit [ chosen ] ) #NEWLINE# ( yield ( chosen , index ) )