-
Notifications
You must be signed in to change notification settings - Fork 760
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
#[pyclass]
on enums MVP
#2013
Comments
(Also, if anyone has strong opinion that this to be a separate |
How about we introduce a new trait in
Related to #906.
It's not clear what's the expected behavior. Python's
|
Agreed for sure. See also #1375 / #1376 which spoke about making "dataclass"-style
Yes I think we can live without this for now as it's an ergonomics improvement in my eyes rather than core functionality.
For C-style enums in #834, I would suggest that if comparisons against integers work as expected then that's probably a great starting point. We will probably want to get feedback from users as to how they want to interact with these things, and shouldn't be afraid of making changes after 0.16 once we do get some feedback. |
We could also solve the subclassing-from-int issue if you think that's necessary. I don't think we're that far out from achieving it. |
I don't have a strong opinion on how to implement that. I suggested subclassing |
By the way, do we treat all enums without data as C-style enums, even if there's no custom discriminant in the enum? |
Why do you need to calculate the discriminants? Can't you just always use |
I didn't know you can cast them to |
After #2002 it's legal to use
#[pyclass]
on enums that have only unit variants.However, there's a few pieces which need finishing (at a minimum) before releasing this change in 0.16:
__richcmp__
implementation so that comparisons work as expected__repr__
implementationThe text was updated successfully, but these errors were encountered: