Joseph L. Casale wrote: > Is it possible to override __contains__ from the meta class in the derived > class with the Enum type?
>>> import enum >>> class M(enum.EnumMeta): ... def __contains__(self, value): ... print("checking", value) ... return super().__contains__(value) ... >>> class Colors(enum.Enum, metaclass=M): ... red = 1 ... green = 2 ... blue = 3 ... >>> Colors.red in Colors checking Colors.red True Is that what you're asking for? If not can you give an example? -- https://mail.python.org/mailman/listinfo/python-list