Closed liammcinroy closed 4 months ago
Thanks for the PR! I wonder, is there any case where users want the module of the variant to be different to the whole enum?
My feeling is no, in which case maybe it's better if we propagate the module from the enum onto all the variants...
@davidhewitt That was also my original feeling (at least, while the variants are still added to the same module as the whole enum). It is an even simpler PR then as well! latest commit has that change
Allows use of the
module
attribute for complex enum variants (but not simple enums), likeso that
Complex.Variant.__module__ == "custom_module"
instead ofbuiltins
Useful to allow pickling (and introspection in general) for complex enums (as noted in https://github.com/PyO3/pyo3/issues/1517#issuecomment-806218369).