#NEWLINE# def _stack_op( stack , func ) : #NEWLINE# #INDENT# "Replaces the top N items from the stack with the items in the list\n       returned by the callable func; N is func's argument count.\n\n       The result must return a list.\n\n       False is returned on error, otherwise True." #NEWLINE# count = len ( inspect . getargspec ( func ) . args ) #NEWLINE# if ( len ( stack ) < count ) : #NEWLINE# #INDENT# return False #NEWLINE# #UNINDENT# args = stack [ ( - count ) : ] #NEWLINE# stack [ ( - count ) : ] = [ ] #NEWLINE# for item in func ( * args ) : #NEWLINE# #INDENT# stack . append ( item ) #NEWLINE# #UNINDENT# return True