Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

functional enum's do not support specifing a shape #1535

Open
rroohhh opened this issue Oct 15, 2024 · 1 comment
Open

functional enum's do not support specifing a shape #1535

rroohhh opened this issue Oct 15, 2024 · 1 comment
Labels

Comments

@rroohhh
Copy link
Contributor

rroohhh commented Oct 15, 2024

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[...] = ...)
@whitequark whitequark added the bug label Oct 15, 2024
@whitequark
Copy link
Member

Yeah, I'd say this is a bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants