On Thursday, October 19, 2017 at 11:55:49 AM UTC-4, Taz Mainiac wrote: > > So - a morning spent googling does not turn up any information about > Python classes having a different id depending on context (script vs > module). I'm probably not googling for the right thing? Can anyone point > me to information? > > The Python classes have a different id on each run not because of the context (script vs module), but because they are run in different processes. The "id" , like the object, is only local to the process.
The attributes of your custom enum class are instances of enum objects. which have attributes like name and value. If you ran two scripts or two modules, it would also almost always fail (IIRC, it is remotely possible but highly unlikely, to generate the same id in another process). You should be storing/comparing the enum's 'name' or 'value' attributes -- not the enum object itself. The enum object will always be different. -- SQLAlchemy - The Python SQL Toolkit and Object Relational Mapper http://www.sqlalchemy.org/ To post example code, please provide an MCVE: Minimal, Complete, and Verifiable Example. See http://stackoverflow.com/help/mcve for a full description. --- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at https://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout.