amaranth icon indicating copy to clipboard operation
amaranth copied to clipboard

functional enum's do not support specifing a `shape`

Open rroohhh opened this issue 1 year ago • 1 comments

Using the functional API to create a enum does not allow for specifing a shape. RFC 3 does not mention the functional API at all, so I guess this is in some way intended, but it would be a useful feature for dynamically creating enum's anyways.

One can workaround this using

MyEnum = types.new_class('MyEnum', (Enum,), kwds={"shape": ...}, exec_body=lambda ns: ns[...] = ...)

rroohhh avatar Oct 15 '24 10:10 rroohhh

Yeah, I'd say this is a bug.

whitequark avatar Oct 15 '24 21:10 whitequark