amaranth
amaranth copied to clipboard
functional enum's do not support specifing a `shape`
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[...] = ...)
Yeah, I'd say this is a bug.