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

Make PauliString's key type generic #3325

Merged
merged 6 commits into from
Sep 23, 2020
Merged

Make PauliString's key type generic #3325

merged 6 commits into from
Sep 23, 2020

Conversation

Strilanc
Copy link
Contributor

@Strilanc Strilanc commented Sep 15, 2020

  • Currently the key type is required to derive from cirq.Qid
  • This is a stepping stone towards allowing non-qid key types

- This is a stepping stone towards allowing non-qubit keys
@googlebot googlebot added the cla: yes Makes googlebot stop complaining. label Sep 15, 2020
Copy link
Contributor

@balopat balopat left a comment

Choose a reason for hiding this comment

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

I added some questions and docs nits

cirq/ops/pauli_string.py Outdated Show resolved Hide resolved
@@ -41,10 +41,14 @@
if TYPE_CHECKING:
import cirq

TDefault = TypeVar('TDefault')
TKey = TypeVar('TKey', bound=raw_types.Qid)
TKey2 = TypeVar('TKey2', bound=raw_types.Qid)
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: Add some docstring to explain what these mean.
Question: Why TKey2? Is there going to be a Tkey3, ... TkeyN eventually as the key types grow?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I split them into TKeyOther and TKeyNew for clarity.

cirq/ops/pauli_string.py Show resolved Hide resolved
cirq/ops/pauli_string.py Outdated Show resolved Hide resolved
Copy link
Contributor

@balopat balopat left a comment

Choose a reason for hiding this comment

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

LGTM, I would still add docstrings to the type variables.

@Strilanc Strilanc added the automerge Tells CirqBot to sync and merge this PR. (If it's running.) label Sep 23, 2020
@CirqBot CirqBot added the front_of_queue_automerge CirqBot uses this label to indicate (and remember) what's being merged next. label Sep 23, 2020
@CirqBot CirqBot merged commit 8a69e8e into master Sep 23, 2020
@CirqBot CirqBot removed the automerge Tells CirqBot to sync and merge this PR. (If it's running.) label Sep 23, 2020
@CirqBot CirqBot deleted the cg/typed_pauli_string branch September 23, 2020 18:26
@CirqBot CirqBot removed the front_of_queue_automerge CirqBot uses this label to indicate (and remember) what's being merged next. label Sep 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes Makes googlebot stop complaining. pr/lgtm-with-nit
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants