Enumerated types or "enums" are a feature of many languages, including Python; enums provide a convenient way to collect up a bunch of related symbols that (typically) evaluate to integer values. The ...
I'm sure the answer is out there somewhere, but I must have overlooked it until now ... I have an X11 programme that I'm mostly using under Mac OS X (10.6.8) and for which I wrote a plugin to extend ...
If you know how to extend Python you also know how to embed it. This even has advanatages from the point of view of testing. This is an extract from the new book by Mike James that helps you combine ...
if x in Colour.names(): ... if x in Colour.values(): ... That provides both use cases, and because it's explicit it's always immediately obvious what is meant, even if you're not familiar with enums.