-
Notifications
You must be signed in to change notification settings - Fork 9
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
feat: Initialize Instruction
s from a Quil string. Python Instruction
s support the pickle
module.
#382
Conversation
|
…e is leftover input, or if the parsed instruction count is not exactly 1
} | ||
Ok(instructions.1[0].to_owned()) | ||
} | ||
} |
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.
Are we good with this being part of the public API?
pickle
module.Instruction
s from a Quil string. Python Instruction
s support the pickle
module.
@@ -45,6 +45,66 @@ macro_rules! impl_to_quil { | |||
}; | |||
} | |||
|
|||
/// Implements pickling for an instruction by implementing __getstate__ and __reduce__. |
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 know you link to the __reduce__
documentation below, but it would probably be better to link to that here as well, or even instead of doing it on __reduce__
itself.
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.
Updated the docstring per your comment.
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'm not familiar with this method of pickling, and I don't have an answer for your question about the public API (I don't know what harm it could do), but otherwise this looks good.
This is great! I see there's already a test for |
Yeah, good eye. We already had a handwritten solution for |
This is to support pyQuil#1791
todo:
impl_pickle_for_instruction
everywhere.