Skip to content

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

Open
@rroohhh

Description

@rroohhh

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[...] = ...)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions