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 zip in transpiler parsing more descriptive #6814

Merged
merged 2 commits into from
Jul 28, 2021

Conversation

jakelishman
Copy link
Member

Summary

As it stands, the zip has become so large that it was unwieldy to name
the variables in the loop. This meant that any modification to the
transpiler arguments that changed the number of elements required
changing the indices of several other elements, making changes harder to
do, near-impossible to spot errors in, and more likely to cause merge
conflicts down the line.

This instead introduces a function which "threads" the zip into a
dictionary, so the arguments can be referenced by name afterwards. This
breaks the position dependence of the arguments, removing a lot of the
risk of conflicts and hard-to-spot errors.

Details and comments

This will cause merge conflicts with any PR in progress that affects the transpiler arguments (e.g. #6124), but should make those PR diffs easier to read in the future, and reduce the chance that other upstream changes cause conflicts, as they have in #6124.

As it stands, the zip has become so large that it was unwieldy to name
the variables in the loop.  This meant that any modification to the
transpiler arguments that changed the number of elements required
changing the indices of several other elements, making changes harder to
do, near-impossible to spot errors in, and more likely to cause merge
conflicts down the line.

This instead introduces a function which "threads" the zip into a
dictionary, so the arguments can be referenced by name afterwards.  This
breaks the position dependence of the arguments, removing a lot of the
risk of conflicts and hard-to-spot errors.
@jakelishman jakelishman requested a review from a team as a code owner July 27, 2021 11:07
@kdk kdk added the Changelog: None Do not include in changelog label Jul 27, 2021
Copy link
Member

@mtreinish mtreinish left a comment

Choose a reason for hiding this comment

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

LGTM, this is definitely much cleaner than what was there before and way less error prone.

@mergify mergify bot merged commit be0ed5f into Qiskit:main Jul 28, 2021
@jakelishman jakelishman deleted the transpiler-descriptive-iterable branch August 2, 2021 09:13
@kdk kdk added this to the 0.19 milestone Nov 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Changelog: None Do not include in changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants