-
Notifications
You must be signed in to change notification settings - Fork 57
Add type annotation for on_space parameter #605
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
Add type annotation for on_space parameter #605
Conversation
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.
The current changes have __init__.py
do a relative import, from .typing import SpaceT
, from the new file pygsti/typing.py
The fact that this is a relative import is easy to miss and led me to think that SpaceT was a built-in type of some kind. I'd prefer that __init__.py
just define SpaceT directly, and that we remove pygsti/typing.py
.
@nkoskelo, if you're strongly opposed to that approach, then let's change the name of pygsti/typing.py
to pgsti/pgtypes.py
or pygsti/pygtypes
.
When one asks for a dense representation of a
modelmember
viato_dense(on_space=?)
, there are 3 options that theon_space
parameter accepts,Hilbert
,HilbertSchmidt
andminimal
. However, when one is coding, editors will not populate these options unless there is a type annotation on the parameteron_space
. This could lead to unintended behavior, if there is a misspelling for instance. The methodto_sparse(on_space=?)
also has this problem.