Enable Structural Pattern Matching for Bit Instances#157
Open
urbanij wants to merge 1 commit intoleonardt:masterfrom
Open
Enable Structural Pattern Matching for Bit Instances#157urbanij wants to merge 1 commit intoleonardt:masterfrom
urbanij wants to merge 1 commit intoleonardt:masterfrom
Conversation
Collaborator
|
Sorry for the slow response, I don't think anyone is actively maintaining this project at this point. While this seems like a pretty reasonable pr in isolation I will decline it. The historical motivation for this tool was to modeling operations done in magma. So all operations are expected to be supported in magma which this cannot be. If you are using magma and you need this for your work I might be convinced to change my mind. |
Author
|
Hi, thanks for your answer - I understand. I figured I could open a PR here because I wanted to use some type that could take only 1 or 0 (a bit indeed), without using a boolean, and I remembered this very project from some time ago. Feel free to close this by all means. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR enables support for positional pattern matching on the Bit class using Python's match statement (introduced in Python 3.10 via PEP 634).
With this change, it becomes possible to use concise and readable pattern matching with Bit instances. For example: