Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use simpler argument style for V2 Sampler #1122

Merged
merged 2 commits into from
Apr 4, 2024
Merged

Use simpler argument style for V2 Sampler #1122

merged 2 commits into from
Apr 4, 2024

Conversation

Eric-Arellano
Copy link
Collaborator

SamplerV2.run() has a flexible argument style. It always needs a list, but each element can either be a single QuantumCircuit or it can be a tuple like (my_circuit,) or (my_circuit, None, 123).

These two lines are functionally equivalent:

sampler.run([circuit1, circuit2])
sampler.run([(circuit1,), (circuit2,)])

But the first one is simpler and easier to understand. So, this PR consistently switches to that style. When we do need the tuple-syntax, we now put each tuple on a dedicated line so that it's easier to see each distinct tuple.

@Eric-Arellano Eric-Arellano requested review from kaelynj and beckykd April 3, 2024 18:29
@qiskit-bot
Copy link
Contributor

One or more of the the following people are requested to review this:

Copy link
Member

@frankharkins frankharkins left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, thanks!

@Eric-Arellano Eric-Arellano added this pull request to the merge queue Apr 4, 2024
Merged via the queue into main with commit 7acbdd0 Apr 4, 2024
4 checks passed
@Eric-Arellano Eric-Arellano deleted the EA/fix-typos branch April 4, 2024 13:08
frankharkins pushed a commit to frankharkins/documentation that referenced this pull request Jul 22, 2024
`SamplerV2.run()` has a flexible argument style. It always needs a list,
but each element can either be a single `QuantumCircuit` or it can be a
tuple like `(my_circuit,)` or `(my_circuit, None, 123)`.

These two lines are functionally equivalent:

```python
sampler.run([circuit1, circuit2])
```

```python
sampler.run([(circuit1,), (circuit2,)])
```

But the first one is simpler and easier to understand. So, this PR
consistently switches to that style. When we do need the tuple-syntax,
we now put each tuple on a dedicated line so that it's easier to see
each distinct tuple.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants