-
Notifications
You must be signed in to change notification settings - Fork 2.2k
There can be only one (enum instance) #1177
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
Comments
This is still an issue with 2.2.4 and very error-prune as the python doc explicitly encourages to check enum values for identity. Minimal example to reproduce
produces this situation
|
@rwgk We're still running into this issue on pybind11 2.9.1 with the minimal repro provided by @televator. Any update on this? |
I could be wrong, but I'm operating under the assumption that the Therefore I added Note that that's in another repo, although it's actually more-or-less just another branch. Could this be merged into pybind11 master? — In theory yes, easily ( You could use the pywrapcc branch and it'll fully interoperate with pybind11 master. There is just no pip-installable release. |
Thank you for the quick response. It's very unfortunate that it won't likely be merged into master. Since the Python docs seem to prefer comparison by identity, I think the pybind11 docs should put a warning in the related section that it isn't supported. |
Please send a PR. I'll look quickly. |
Here is the PR. |
Currently enums compare equal with
==
but not withis
.I think it would be good if enums would be singletons like
None
instead.The text was updated successfully, but these errors were encountered: