[SMALL] Support adding a single instruction to moments
moments.add() and circuit.add() are slightly inconsistent.
circuits accept both Instruction and Iterable[Instruction] while moments take a strict Iterable.
This is confusing for the user:
circ.moments.add(Instruction(gate, target)) # doesnt work
circ.moments.add([Instruction(gate, target)]) # works
while both work for circuit classes:
circ.add(Instruction(gate, target)) # works
circ.add([Instruction(gate, target)]) # works
In the src code:
def add(self, instructions: Iterable[Instruction], noise_index: int = 0) -> None: # [moments](https://github.com/aws/amazon-braket-sdk-python/blob/main/src/braket/circuits/moments.py#L162)
def add(self, addable: AddableTypes, *args, **kwargs) -> Circuit: # [circuits](https://github.com/aws/amazon-braket-sdk-python/blob/main/src/braket/circuits/circuit.py#L777)
Objective: Update the Moments.add() method to accept Union[Instruction, Iterable[Instruction]]
Note: We expect a small task to take hours or a few days to complete dependent on your level of familiarity with the Braket SDK.
Hi, I would like to work on this issue,🙂
Hi, I would like to work on this issue,🙂
@himanshu007-creator touching base. Have you started looking at this issue? If you're stuck on how to proceed let us know.