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

Matching of Python3 enum #20

Closed
HarryR opened this issue Feb 8, 2019 · 1 comment
Closed

Matching of Python3 enum #20

HarryR opened this issue Feb 8, 2019 · 1 comment

Comments

@HarryR
Copy link

HarryR commented Feb 8, 2019

Matching Python 3 Enum classes always fails.

This can be fixed by adding support for Enum at:

elif isinstance(pattern, (int, float, str, bool)):

To:

from enum import Enum

# ...

    elif isinstance(pattern, (int, float, str, bool, Enum)):

Built-in equality checks for enum types will work the same as other scalar values.

However, this will break Python 2.x compatibility, where no Enum type is available.

@santinic
Copy link
Owner

Thanks Harry!

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

No branches or pull requests

2 participants