Message329994
I ran into the same issue and while I see that this is not a bug I would suggest that this behaviour at least deserves a warning in the documentation under
https://docs.python.org/3/library/enum.html#comparisons
This unexpected behaviour can not only occur with messed up imports, but also when a module uses the importlib.reload() function and submodules are reloaded during runtime.
I attached a minimal working example.
In our case we have a central module where all constants, dataclasses and enums are defined. A main program imports several submodules which all import these datatypes. Reloading a submodule results in new object ids for the enums in this submodule and comparing data between different modules suddenly results in inconsistent behaviour.
It took a while to debug, because except for the object id the enums look exactly the same and before reading this thread I did not realize that the comparison is actually done by object ids. |
|
Date |
User |
Action |
Args |
2018-11-16 13:05:55 | Sebastian Höfer | set | recipients:
+ Sebastian Höfer, r.david.murray, ethan.furman, adrianwan2, Madhav Datt, Markus Wegmann |
2018-11-16 13:05:55 | Sebastian Höfer | set | messageid: <1542373555.67.0.788709270274.issue30545@psf.upfronthosting.co.za> |
2018-11-16 13:05:55 | Sebastian Höfer | link | issue30545 messages |
2018-11-16 13:05:55 | Sebastian Höfer | create | |
|