-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Conversation
Strilanc
commented
Sep 15, 2020
•
edited
Loading
edited
- 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
There was a problem hiding this 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
@@ -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) |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this 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.