>>>> 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?
Hi Peter, That is exactly what I was referring to, I just wondered if I overlooked some way to apply it after the initial meta class built the instance. It appears not... Thanks! jlc -- https://mail.python.org/mailman/listinfo/python-list