#NEWLINE# def partitioni( n , step , seq = EMPTY ) : #NEWLINE# #INDENT# if ( seq is EMPTY ) : #NEWLINE# #INDENT# ( step , seq ) = ( n , step ) #NEWLINE# #UNINDENT# it = iter ( seq ) #NEWLINE# pool_limit = max ( ( n * 2 ) , 512 ) #NEWLINE# pool = take ( ( n - 1 ) , it ) #NEWLINE# for ( i , item ) in enumerate ( it , start = n ) : #NEWLINE# #INDENT# pool . append ( item ) #NEWLINE# if ( len ( pool ) > pool_limit ) : #NEWLINE# #INDENT# pool = pool [ ( - n ) : ] #NEWLINE# #UNINDENT# if ( ( pool % step ) == 0 ) : #NEWLINE# #INDENT# ( yield pool [ ( - n ) : ] )