13 Oct
2019
13 Oct
'19
8:28 p.m.
On Mon, Oct 14, 2019 at 12:18 AM Steve Jorgensen
class BrightColorsMeta(type): def __rin__(self, other): other.startswith('bright ')
class BrightColors(metaclass=BrightColorsMeta): pass
'red' in BrightColors # -> False 'bright blue' in BrightColors # -> True
For this specific example, have you looked at the enum module? https://docs.python.org/3/library/enum.html You can create a class that represents the enumeration, have members for each valid term, and then see if something is a part of the enumeration. ChrisA