Skip to content

Support for Python 3.4+ enums #309

@svisser

Description

@svisser

This is a ticket to explore the possibility of adding support for Python 3.4+ enums to voluptuous.

So far it's possible to write:

import enum

from voluptuous import In, Schema

class MyEnum(enum.Enum):
    A = 'a'
    B = 'b'

s = Schema(In(item.value for item in MyEnum))
s('a')

but perhaps it would be nice if it could be written as the following?

s = Schema(In(MyEnum))

or:

s = Schema(MyEnum)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions