This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Sebastian Höfer
Recipients Madhav Datt, Markus Wegmann, Sebastian Höfer, adrianwan2, ethan.furman, r.david.murray
Date 2018-11-16.13:05:55
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1542373555.67.0.788709270274.issue30545@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2018-11-16 13:05:55Sebastian Höfersetrecipients: + Sebastian Höfer, r.david.murray, ethan.furman, adrianwan2, Madhav Datt, Markus Wegmann
2018-11-16 13:05:55Sebastian Höfersetmessageid: <1542373555.67.0.788709270274.issue30545@psf.upfronthosting.co.za>
2018-11-16 13:05:55Sebastian Höferlinkissue30545 messages
2018-11-16 13:05:55Sebastian Höfercreate