hwtypes
hwtypes copied to clipboard
Enable Structural Pattern Matching for Bit Instances
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:
bit = Bit(0)
match bit:
case Bit(0):
print("Matched 0")
case Bit(1):
print("Matched 1")