generalize num_operands