hwtypes icon indicating copy to clipboard operation
hwtypes copied to clipboard

Enable Structural Pattern Matching for Bit Instances

Open urbanij opened this issue 5 months ago • 2 comments

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")   

urbanij avatar Aug 07 '25 14:08 urbanij