CPAlgorithms: use identity operators instead of equality for python enums
As recommended in PEP-8
Comparisons to singletons like
Noneshould always be done withisoris not, never the equality operators.
Also, beware of writing
if xwhen you really meanif x is not None– e.g. when testing whether a variable or argument that defaults toNonewas set to some other value. The other value might have a type (such as a container) that could be false in a boolean context!
When comparing Enum members, identity (
is) comparisons are preferred over equality (==) comparisons.