# Buggy code
def append(self, instruction, qargs=None, cargs=None):
    """Append one or more instructions to the end of the circuit, modifying
    the circuit in place. Expands qargs and cargs.

    Args:
        instruction (Instruction or Operation): Instruction instance to append
        qargs (list(argument)): qubits to attach instruction to
        cargs (list(argument)): clbits to attach instruction to

    Returns:
        Instruction: a handle to the instruction that was just added
    """
    # Convert input to instruction
    if not isinstance(instruction, Instruction) and hasattr(
        instruction, "to_instruction"
    ):
        instruction = instruction.to_instruction()

    expanded_qargs = [self.qbit_argument_conversion(qarg) for qarg in qargs or []]
    expanded_cargs = [self.cbit_argument_conversion(carg) for carg in cargs or []]

    instructions = InstructionSet()
    for qarg, carg in instruction.broadcast_arguments(expanded_qargs, expanded_cargs):
        instructions.add(self._append(instruction, qarg, carg), qarg, carg)
    return instructions


# Traceback (QiskitError)
---------------------------------------------------------------------------
QiskitError                               Traceback (most recent call last)
<ipython-input-15-d7ba5e55b137> in <module>
4
5 circuits = [qc.bind_parameters({theta: theta_val})
----> 6             for theta_val in theta_range]
7
8 print(circuits[-1].draw(line_length=120))

<ipython-input-15-d7ba5e55b137> in <listcomp>(.0)
4
5 circuits = [qc.bind_parameters({theta: theta_val})
----> 6             for theta_val in theta_range]
7
8 print(circuits[-1].draw(line_length=120))

~/git/qiskit/qiskit-core/qiskit/circuit/quantumcircuit.py in bind_parameters(self, value_dict)
857
858         for parameter, value in unrolled_value_dict.items():
--> 859             new_circuit._bind_parameter(parameter, value)
860         # clear evaluated expressions
861         for parameter in unrolled_value_dict:

~/git/qiskit/qiskit-core/qiskit/circuit/quantumcircuit.py in _bind_parameter(self, parameter, value)
879         """Assigns a parameter value to matching instructions in-place."""
880         for (instr, param_index) in self._parameter_table[parameter]:
--> 881             instr.params[param_index] = instr.params[param_index].bind({parameter: value})
882
883     def _substitute_parameters(self, parameter_map):

~/git/qiskit/qiskit-core/qiskit/circuit/parameterexpression.py in bind(self, parameter_values)
66         """
67
---> 68         self._raise_if_passed_unknown_parameters(parameter_values.keys())
69         self._raise_if_passed_non_real_value(parameter_values)
70

~/git/qiskit/qiskit-core/qiskit/circuit/parameterexpression.py in _raise_if_passed_unknown_parameters(self, parameters)
134             raise QiskitError('Cannot bind Parameters ({}) not present in '
135                               'expression.'.format(
--> 136                                   [str(p) for p in unknown_parameters]))
137
138     def _raise_if_passed_non_real_value(self, parameter_values):

QiskitError: "Cannot bind Parameters (['θ']) not present in expression."

# Fixed code
def append(self, instruction, qargs=None, cargs=None):
    """Append one or more instructions to the end of the circuit, modifying
    the circuit in place. Expands qargs and cargs.

    Args:
        instruction (Instruction or Operation): Instruction instance to append
        qargs (list(argument)): qubits to attach instruction to
        cargs (list(argument)): clbits to attach instruction to

    Returns:
        Instruction: a handle to the instruction that was just added
    """
    # Convert input to instruction
    if not isinstance(instruction, Instruction) and hasattr(
        instruction, "to_instruction"
    ):
        instruction = instruction.to_instruction()

    expanded_qargs = [self.qbit_argument_conversion(qarg) for qarg in qargs or []]
    expanded_cargs = [self.cbit_argument_conversion(carg) for carg in cargs or []]

    instructions = InstructionSet()

    # When broadcasting was handled by decorators (prior to #2282), append
    # received multiple distinct instruction instances, one for each expanded
    # arg. With broadcasting as part of QuantumCircuit.append, the
    # instruction instance is constructed before append is called. However,
    # (at least) ParameterTable expects instruction instances to be unique
    # within a circuit, so make instruction deepcopies for expanded_args[1:].

    first_instruction = True
    for qarg, carg in instruction.broadcast_arguments(expanded_qargs, expanded_cargs):
        if first_instruction:
            instructions.add(self._append(instruction, qarg, carg), qarg, carg)
            first_instruction = False
        else:
            instructions.add(
                self._append(deepcopy(instruction), qarg, carg), qarg, carg
            )

    return instructions