def _stack_op(stack, func):

    # not enough arguments
    count = len(inspect.getargspec(func).args)
    if len(stack) < count: return False
    args = stack[-count:]
    stack[-count:] = []

    # add each returned item onto the stack
    for item in func(*args):
        stack.append(item)

    return True
Replaces the top N items from the stack with the items in the list
dataset/ETHPy150Open ricmoo/pycoind/pycoind/script/script.py/_stack_op